Index: trunk/src/lua/lua_state.cc
===================================================================
--- trunk/src/lua/lua_state.cc	(revision 360)
+++ trunk/src/lua/lua_state.cc	(revision 361)
@@ -179,10 +179,40 @@
 }
 
-string lua::table_guard::get_string( string_ref element, string_ref defval /*= string_ref() */ )
-{
-	lua_getfield( m_state, -1, element.data() );
-	string result( ( lua_type( m_state, -1 ) == LUA_TSTRING ) ? lua_tostring( m_state, -1 ) : defval.to_string() );
-	lua_pop( m_state, 1 );
-	return result;
+string lua::table_guard::get_std_string( string_ref element, string_ref defval /*= string_ref() */ )
+{
+	lua_getfield( m_state, -1, element.data() );
+	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();
+	}
+	std::string result( str, l );
+	lua_pop( m_state, 1 );
+	return result;
+}
+
+const_string lua::table_guard::get_string( string_ref element, string_ref defval /*= string_ref() */ )
+{
+ 	lua_getfield( m_state, -1, element.data() );
+ 	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;
 }
 
