Index: trunk/src/lua/lua_state.cc
===================================================================
--- trunk/src/lua/lua_state.cc	(revision 503)
+++ trunk/src/lua/lua_state.cc	(revision 505)
@@ -201,5 +201,5 @@
 }
 
-shash64 nv::lua::table_guard::get_string( string_view element, string_table& table, uint64 defval /*= 0 */ )
+nv::shash64 nv::lua::table_guard::get_string( string_view element, string_table* table, uint64 defval /*= 0 */ )
 {
 	lua_getfield( m_state, -1, element.data() );
@@ -210,13 +210,68 @@
 	{
 		str = lua_tolstring( m_state, -1, &l );
-		result = table.insert( string_view( str, l ) );
-	}
-	lua_pop( m_state, 1 );
-	return result;
-}
-
-nv::shash64 nv::lua::table_guard::get_string( string_view element, string_table* table, uint64 defval /*= 0 */ )
-{
-	lua_getfield( m_state, -1, element.data() );
+		string_view sv( str, l );
+		result = table ? table->insert( sv ) : shash64( sv );
+	}
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+shash64 nv::lua::table_guard::get_string_hash_64( int i, uint64 defval /*= 0 */ )
+{
+	lua_rawgeti( m_state, -1, i );
+	size_t l = 0;
+	const char* str = nullptr;
+	uint64 result = defval;
+	if ( lua_type( m_state, -1 ) == LUA_TSTRING )
+	{
+		str = lua_tolstring( m_state, -1, &l );
+		result = hash_string< uint64 >( str, l );
+		//NV_LOG_DEBUG( str );
+	}
+	lua_pop( m_state, 1 );
+	return shash64( result );
+}
+
+nv::string128 nv::lua::table_guard::get_string128( int i, string_view defval /*= string_view() */ )
+{
+	lua_rawgeti( m_state, -1, i );
+	size_t l = 0;
+	const char* str = nullptr;
+	if ( lua_type( m_state, -1 ) == LUA_TSTRING )
+	{
+		str = lua_tolstring( m_state, -1, &l );
+	}
+	else
+	{
+		l = defval.size();
+		str = defval.data();
+	}
+	string128 result( str, l );
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+const_string nv::lua::table_guard::get_string( int i, string_view defval /*= string_view() */ )
+{
+	lua_rawgeti( m_state, -1, i );
+	size_t l = 0;
+	const char* str = nullptr;
+	if ( lua_type( m_state, -1 ) == LUA_TSTRING )
+	{
+		str = lua_tolstring( m_state, -1, &l );
+	}
+	else
+	{
+		l = defval.size();
+		str = defval.data();
+	}
+	const_string result( str, l );
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+shash64 nv::lua::table_guard::get_string( int i, string_table* table, uint64 defval /*= 0 */ )
+{
+	lua_rawgeti( m_state, -1, i );
 	size_t l = 0;
 	const char* str = nullptr;
@@ -302,4 +357,52 @@
 }
 
+char nv::lua::table_guard::get_char( int i, char defval /*= ' ' */ )
+{
+	lua_rawgeti( m_state, -1, i );
+	char result = ( lua_type( m_state, -1 ) == LUA_TSTRING && nlua_rawlen( m_state, -1 ) > 0 ) ? lua_tostring( m_state, -1 )[0] : defval;
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+int nv::lua::table_guard::get_integer( int i, int defval /*= 0 */ )
+{
+	lua_rawgeti( m_state, -1, i );
+	lua_Integer result = lua_type( m_state, -1 ) == LUA_TNUMBER ? lua_tointeger( m_state, -1 ) : defval;
+	lua_pop( m_state, 1 );
+	return static_cast<int>( result );
+}
+
+unsigned nv::lua::table_guard::get_unsigned( int i, unsigned defval /*= 0 */ )
+{
+	lua_rawgeti( m_state, -1, i );
+	unsigned result = lua_type( m_state, -1 ) == LUA_TNUMBER ? nlua_tounsigned( m_state, -1 ) : defval;
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+double nv::lua::table_guard::get_double( int i, double defval /*= 0.0 */ )
+{
+	lua_rawgeti( m_state, -1, i );
+	double result = lua_type( m_state, -1 ) == LUA_TNUMBER ? lua_tonumber( m_state, -1 ) : defval;
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+float nv::lua::table_guard::get_float( int i, float defval /*= 0.0 */ )
+{
+	lua_rawgeti( m_state, -1, i );
+	float result = lua_type( m_state, -1 ) == LUA_TNUMBER ? static_cast<float>( lua_tonumber( m_state, -1 ) ) : defval;
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+bool nv::lua::table_guard::get_boolean( int i, bool defval /*= false */ )
+{
+	lua_rawgeti( m_state, -1, i );
+	bool result = lua_type( m_state, -1 ) == LUA_TBOOLEAN ? lua_toboolean( m_state, -1 ) != 0 : defval;
+	lua_pop( m_state, 1 );
+	return result;
+}
+
 float nv::lua::table_guard::get_float( string_view element, float defval /*= 0.0 */ )
 {
@@ -326,4 +429,36 @@
 }
 
+bool nv::lua::table_guard::is_table( int i )
+{
+	lua_rawgeti( m_state, -1, i );
+	bool result = lua_type( m_state, -1 ) == LUA_TTABLE;
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+bool nv::lua::table_guard::is_number( int i )
+{
+	lua_rawgeti( m_state, -1, i );
+	bool result = lua_type( m_state, -1 ) == LUA_TNUMBER;
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+bool nv::lua::table_guard::is_boolean( int i )
+{
+	lua_rawgeti( m_state, -1, i );
+	bool result = lua_type( m_state, -1 ) == LUA_TBOOLEAN;
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+bool nv::lua::table_guard::is_string( int i )
+{
+	lua_rawgeti( m_state, -1, i );
+	bool result = lua_type( m_state, -1 ) == LUA_TSTRING;
+	lua_pop( m_state, 1 );
+	return result;
+}
+
 bool nv::lua::table_guard::is_number( string_view element )
 {
@@ -349,5 +484,4 @@
 	return result;
 }
-
 
 bool nv::lua::table_guard::read( const string_view& element, const type_entry* entry, void* object )
