Index: trunk/nv/core/string_ref.hh
===================================================================
--- trunk/nv/core/string_ref.hh	(revision 357)
+++ trunk/nv/core/string_ref.hh	(revision 358)
@@ -60,8 +60,5 @@
 		template< typename U, typename std::enable_if<std::is_same<U,const char*>::value>::type* = nullptr >
 		basic_string_ref( U str )
-			: m_data( str ), m_length( TRAITS::length( str ) )
-		{
-			static_assert( std::is_same<T, U>::value  );
-		}
+			: m_data( str ), m_length( TRAITS::length( str ) ) {}
 
 		basic_string_ref& operator=( const basic_string_ref &rhs )
Index: trunk/nv/lua/lua_function.hh
===================================================================
--- trunk/nv/lua/lua_function.hh	(revision 357)
+++ trunk/nv/lua/lua_function.hh	(revision 358)
@@ -9,5 +9,4 @@
 
 #include <nv/core/common.hh>
-#include <nv/core/string.hh>
 #include <nv/lua/lua_values.hh>
 #include <nv/lua/lua_path.hh>
Index: trunk/nv/lua/lua_nova.hh
===================================================================
--- trunk/nv/lua/lua_nova.hh	(revision 357)
+++ trunk/nv/lua/lua_nova.hh	(revision 358)
@@ -13,5 +13,5 @@
 	namespace lua
 	{
-		void register_storage( state* a_state, const string& name, const string& constructor_name );
+		void register_storage( state* a_state, string_ref name, string_ref constructor_name );
 		void register_nova( state* a_state );
 	}
Index: trunk/nv/lua/lua_state.hh
===================================================================
--- trunk/nv/lua/lua_state.hh	(revision 357)
+++ trunk/nv/lua/lua_state.hh	(revision 358)
@@ -15,4 +15,5 @@
 #include <nv/core/flags.hh>
 #include <nv/core/handle.hh>
+#include <nv/core/string_ref.hh>
 #include <istream>
 #include <map>
Index: trunk/nv/lua/lua_values.hh
===================================================================
--- trunk/nv/lua/lua_values.hh	(revision 357)
+++ trunk/nv/lua/lua_values.hh	(revision 358)
@@ -11,4 +11,5 @@
 #include <nv/core/type_traits.hh>
 #include <nv/core/string.hh>
+#include <nv/core/string_ref.hh>
 
 struct lua_State;
@@ -74,4 +75,5 @@
 			void push_bool       ( lua_State *L, bool v );
 			void push_string     ( lua_State *L, const std::string& s );
+			void push_string_ref ( lua_State *L, string_ref s );
 			void push_cstring    ( lua_State *L, const char* s );
 			void push_pointer    ( lua_State *L, void* p );
@@ -84,4 +86,5 @@
 			std::string to_string     ( lua_State *L, int index );
 			const char* to_cstring    ( lua_State *L, int index );
+			string_ref  to_string_ref ( lua_State *L, int index );
 			void*       to_pointer    ( lua_State *L, int index );
 			void*       to_ref_object ( lua_State *L, int index );
@@ -93,4 +96,5 @@
 			std::string to_string     ( lua_State *L, int index, const std::string& def );
 			const char* to_cstring    ( lua_State *L, int index, const char* def );
+			string_ref  to_string_ref ( lua_State *L, int index, string_ref def );
 			void*       to_pointer    ( lua_State *L, int index, void* def );
 			void*       to_ref_object ( lua_State *L, int index, void* def );
@@ -156,4 +160,12 @@
 
 		template <>
+		struct pass_traits < string_ref >
+		{
+			static void push( lua_State *L, string_ref s ) { detail::push_string_ref( L, s ); }
+			static string_ref to( lua_State *L, int index ) { return detail::to_string_ref( L, index ); }
+			static string_ref to( lua_State *L, int index, string_ref def ) { return detail::to_string_ref( L, index, def ); }
+		};
+
+		template <>
 		struct pass_traits<ref>
 		{
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 );
 }
 
