Index: trunk/src/engine/resource_system.cc
===================================================================
--- trunk/src/engine/resource_system.cc	(revision 357)
+++ trunk/src/engine/resource_system.cc	(revision 358)
@@ -14,5 +14,6 @@
 	std::string constructor_name( get_resource_name() );
 	constructor_name = "register_"+constructor_name;
-	lua::register_storage( m_lua, get_storage_name(), constructor_name.c_str() );
+	int correct = 0;
+	lua::register_storage( m_lua, get_storage_name(), constructor_name );
 }
 
Index: trunk/src/lua/lua_nova.cc
===================================================================
--- trunk/src/lua/lua_nova.cc	(revision 357)
+++ trunk/src/lua/lua_nova.cc	(revision 358)
@@ -83,5 +83,5 @@
 		lua_pushvalue( L, itype );
 		lua_pushvalue( L, iid );
-		lua_pushstring( L, "." );
+		lua_pushliteral( L, "." );
 		lua_pushvalue( L, ifield );
 		lua_concat( L, 3 );
@@ -292,5 +292,5 @@
 {
 	// storage.__counter++
-	lua_pushstring( L, "__counter" );
+	lua_pushliteral( L, "__counter" );
 	lua_pushvalue( L, -1 );
 	lua_rawget( L, 1 );
@@ -303,5 +303,5 @@
 
 	// element.nid = __counter
-	lua_pushstring( L, "nid" );
+	lua_pushliteral( L, "nid" );
 	lua_pushinteger( L, count );
 	lua_rawset( L, 2 );
@@ -322,5 +322,5 @@
 
 	// element.id = element.id 
-	lua_pushstring( L, "id" );
+	lua_pushliteral( L, "id" );
 	lua_rawget( L, 2 );
 	if ( lua_isnil( L, -1 ) )
@@ -413,5 +413,5 @@
 
 	lua_pushvalue( L, 1 );
-	lua_pushstring( L, "." );
+	lua_pushliteral( L, "." );
 	lua_pushvalue( L, 2 );
 	lua_concat( L, 3 ); // new ident index 5
@@ -449,5 +449,5 @@
 
 	lua_pushvalue( L, 1 );
-	lua_pushstring( L, "." );
+	lua_pushliteral( L, "." );
 	lua_pushvalue( L, 2 );
 	lua_concat( L, 3 ); // new ident index 6
@@ -579,4 +579,5 @@
 	if ( lua_type( L, 1 ) == LUA_TSTRING )
 	{
+		// TODO: Optimzie
 		lua_getglobal( L, lua_tostring( L, 1 ) );
 		lua_replace( L, 1 );
@@ -809,5 +810,5 @@
 }
 
-void nv::lua::register_storage( state* a_state, const string& name, const string& constructor_name )
+void nv::lua::register_storage( state* a_state, string_ref name, string_ref constructor_name )
 {
 	// TODO: error checking
@@ -816,7 +817,7 @@
 	// TODO: check if nova is loaded
 	lua_pushcfunction( L, nova_register_storage );
-	lua_pushstring( L, name.c_str() );
+	lua_pushlstring( L, name.data(), name.size() );
 	lua_call( L, 1, 1 );
-	lua_setglobal( L, constructor_name.c_str() );
+	lua_setglobal( L, constructor_name.data() );
 	lua_settop( L, stack );
 }
Index: trunk/src/lua/lua_values.cc
===================================================================
--- trunk/src/lua/lua_values.cc	(revision 357)
+++ trunk/src/lua/lua_values.cc	(revision 358)
@@ -75,4 +75,9 @@
 }
 
+void nv::lua::detail::push_string_ref( lua_State *L, string_ref s )
+{
+	lua_pushlstring( L, s.data(), s.size() );
+}
+
 void nv::lua::detail::push_pointer ( lua_State *L, void* p )
 {
@@ -108,10 +113,19 @@
 std::string nv::lua::detail::to_string  ( lua_State *L, int index )
 {
-	return lua_tostring( L, index );
+	size_t length = 0;
+	const char* result = lua_tolstring( L, index, &length );
+	return std::string( result, length );
 }
 
 const char* nv::lua::detail::to_cstring ( lua_State *L, int index )
 {
-	return lua_tostring( L, index );
+	return lua_tolstring( L, index, nullptr );
+}
+
+nv::string_ref nv::lua::detail::to_string_ref( lua_State *L, int index )
+{
+	size_t length = 0;
+	const char* result = lua_tolstring( L, index, &length );
+	return string_ref( result, length );
 }
 
