Index: trunk/src/core/library.cc
===================================================================
--- trunk/src/core/library.cc	(revision 435)
+++ trunk/src/core/library.cc	(revision 437)
@@ -6,4 +6,5 @@
 
 #include "nv/core/library.hh"
+#include <string>
 
 #if NV_PLATFORM == NV_WINDOWS
@@ -40,5 +41,5 @@
 void library::open( string_view name )
 {
-	m_name.assign( name.data(), name.size() );
+	m_name = name;
 	if ( !open() )
 	{
@@ -51,5 +52,5 @@
 bool nv::library::try_open( string_view name )
 {
-	m_name.assign( name.data(), name.size() );
+	m_name = name;
 	if ( !open() )
 	{
@@ -62,5 +63,5 @@
 string_view library::get_name() const
 {
-    return string_view( m_name.c_str(), m_name.size() );
+    return m_name;
 }
 
@@ -71,7 +72,7 @@
         return true;
     }
-    NV_LOG_NOTICE( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : loading..." );
+    NV_LOG_NOTICE( "library \"", m_name, "\" : loading..." );
 
-	std::string name = m_name;
+	std::string name( m_name.data(), m_name.length() );
 	std::string ext( NV_LIB_EXT );
 
@@ -85,8 +86,7 @@
     if ( m_handle == NULL )
     {
-		NV_LOG_NOTICE( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : failed to open!" );
+		NV_LOG_NOTICE( "library \"", m_name, "\" : failed to open!" );
 		return false;
     }
-    NV_LOG_NOTICE( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : loaded." );
 	return true;
 }
@@ -97,5 +97,5 @@
     if ( !result )
     {
-		NV_LOG_CRITICAL( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : can't find symbol \"", symbol, "\"" );
+		NV_LOG_CRITICAL( "library \"", m_name, "\" : can't find symbol \"", symbol, "\"" );
 		NV_ABORT( "Library symbol load failed!" );
     }
@@ -117,5 +117,5 @@
     if ( ! NV_LIB_CLOSE( m_handle ) )
     {
-        NV_LOG_ERROR( "library \"", string_view( m_name.c_str(), m_name.size() ), "\" : can't close library!" );
+        NV_LOG_ERROR( "library \"", m_name, "\" : can't close library!" );
     }
     m_handle = nullptr;
@@ -130,18 +130,16 @@
 }
 
-std::string library::get_error()
+nv::string_view library::get_error()
 {
 #if NV_PLATFORM == NV_WINDOWS
     // We do hate WinAPI for code like this, don't we?
-    LPTSTR buffer = nullptr;
-    FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-        NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPTSTR>( &buffer ), 0, NULL );
-    std::string msg( reinterpret_cast<char*>( buffer ) );
-    LocalFree( buffer );
-    return msg;
+	static TCHAR buffer[256];
+    FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+        NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPTSTR>( &buffer ), 256, NULL );
+    return string_view( reinterpret_cast<char*>( buffer ) );
 #elif NV_PLATFORM == NV_LINUX || NV_PLATFORM == NV_APPLE
-    return std::string( dlerror() );
+    return nv::string_view( dlerror() );
 #else
-    return std::string("");
+    return nv::string_view();
 #endif
 }
Index: trunk/src/gui/gui_gfx_renderer.cc
===================================================================
--- trunk/src/gui/gui_gfx_renderer.cc	(revision 435)
+++ trunk/src/gui/gui_gfx_renderer.cc	(revision 437)
@@ -235,5 +235,5 @@
 	size_t size_before = er->buffer.data().size();
 
-	std::vector< gui_quad >& qvec = er->buffer.lock();
+	vector< gui_quad >& qvec = er->buffer.lock();
 
 	qvec.clear();
Index: trunk/src/lua/lua_map_area.cc
===================================================================
--- trunk/src/lua/lua_map_area.cc	(revision 435)
+++ trunk/src/lua/lua_map_area.cc	(revision 437)
@@ -137,6 +137,5 @@
 {
 	nv::map_area* ma = to_map_area( L, 1 );
-	nv::string_view result( ma->id_to_string( ma->get_cell( to_coord( L, 2 ) ) ) );
-	lua_pushlstring( L, result.data(), result.size() );
+	nlua_pushstringview( L, ma->id_to_string( ma->get_cell( to_coord( L, 2 ) ) ) );
 	return 1;
 }
Index: trunk/src/lua/lua_nova.cc
===================================================================
--- trunk/src/lua/lua_nova.cc	(revision 435)
+++ trunk/src/lua/lua_nova.cc	(revision 437)
@@ -817,5 +817,5 @@
 	// TODO: check if nova is loaded
 	lua_pushcfunction( L, nova_register_storage );
-	lua_pushlstring( L, name.data(), name.size() );
+	nlua_pushstringview( L, name );
 	lua_call( L, 1, 1 );
 	lua_setglobal( L, constructor_name.data() );
Index: trunk/src/lua/lua_raw.cc
===================================================================
--- trunk/src/lua/lua_raw.cc	(revision 435)
+++ trunk/src/lua/lua_raw.cc	(revision 437)
@@ -7,7 +7,5 @@
 #include "nv/lua/lua_raw.hh"
 
-#include "nv/stl/string.hh"
-
-std::string nlua_typecontent( lua_State* L, int idx )
+nv::string_view nlua_typecontent( lua_State* L, int idx )
 {
 	int type = lua_type( L, idx );
@@ -19,5 +17,6 @@
 	//case LUA_TLIGHTUSERDATA	: return std::to_string( nv::uint64( lua_touserdata( L, idx ) ) ); 
 	//case LUA_TNUMBER		: return std::to_string( lua_tonumber( L, idx ) ); 
-	case LUA_TSTRING		: return lua_tostring( L, idx ); 
+	// TODO: copy to buffer?
+	case LUA_TSTRING		: return nlua_tostringview( L, idx ); 
 	case LUA_TTABLE		    : return "TABLE"; 
 	case LUA_TFUNCTION		: return "FUNCTION"; 
@@ -26,15 +25,15 @@
 	default : break; 
 	}
-	char buffer_data[64];
+	static char buffer_data[64];
 	nv::array_ref< char > buffer( buffer_data, 64 );
 	if ( type == LUA_TLIGHTUSERDATA || type == LUA_TUSERDATA )
 	{
 		size_t l = nv::uint64_to_buffer( buffer, nv::uint64( lua_touserdata( L, idx ) ) );
-		return std::string( buffer_data, l );
+		return nv::string_view( buffer.data(), buffer.size() );
 	}
 	else if ( type == LUA_TNUMBER )
 	{
 		size_t l = nv::f64_to_buffer( buffer, lua_tonumber( L, idx ) );
-		return std::string( buffer_data, l );
+		return nv::string_view( buffer.data(), buffer.size() );
 	}
 	return "UNKNOWN!";
Index: trunk/src/lua/lua_state.cc
===================================================================
--- trunk/src/lua/lua_state.cc	(revision 435)
+++ trunk/src/lua/lua_state.cc	(revision 437)
@@ -134,5 +134,5 @@
 	if ( status != 0 )
 	{
-		NV_LOG_ERROR( "Lua error : ", lua_tostring( m_state, -1 ) );
+		NV_LOG_ERROR( "Lua error : ", nlua_tostringview( m_state, -1 ) );
 		lua_pop( m_state, 1 );
 	}
@@ -402,5 +402,5 @@
 	if (result)
 	{
-		NV_LOG_WARNING( "Failed to load string ", name, ": ", lua_tostring(m_state, -1));
+		NV_LOG_WARNING( "Failed to load string ", name, ": ", nlua_tostringview(m_state, -1));
 		return false;
 	}
@@ -414,5 +414,5 @@
 	if (result) 
 	{
-		NV_LOG_WARNING( "Failed to open file ", filename, ": ", lua_tostring( m_state, -1 ) );
+		NV_LOG_WARNING( "Failed to open file ", filename, ": ", nlua_tostringview( m_state, -1 ) );
 		return false;
 	}
@@ -425,5 +425,5 @@
 	if (result) 
 	{
-		NV_LOG_WARNING( "Failed to run script ", name, ": ", lua_tostring( m_state, -1 ) );
+		NV_LOG_WARNING( "Failed to run script ", name, ": ", nlua_tostringview( m_state, -1 ) );
 		lua_pop( m_state, 1 );
 	}
@@ -442,5 +442,5 @@
 	for ( int i = 0; i < top; ++i )
 	{
-		NV_LOG_DEBUG( "#", i+1, " - ", lua_typename(m_state, lua_type(m_state, i+1) ), " = ", nlua_typecontent(m_state, i+1).c_str() );
+		NV_LOG_DEBUG( "#", i+1, " - ", lua_typename(m_state, lua_type(m_state, i+1) ), " = ", nlua_typecontent(m_state, i+1) );
 	}
 }
@@ -546,5 +546,5 @@
 	if ( !object_index.is_valid() ) return;
 	lua_rawgeti( m_state, LUA_REGISTRYINDEX, object_index.get() );
-	lua_pushlstring( m_state, metaname.data(), metaname.size() );
+	nlua_pushstringview( m_state, metaname );
 	lua_pushlightuserdata( m_state, pointer );
 	lua_rawset( m_state, -3 );
@@ -572,5 +572,5 @@
 	else
 		nlua_deepcopy( m_state, -2 );
-	lua_pushlstring( m_state, id.data(), id.size() );
+	nlua_pushstringview( m_state, id );
 	lua_pushvalue( m_state, -2 );
 	lua_rawset( m_state, -4 );
@@ -590,5 +590,5 @@
 		return;
 	}
-	lua_pushlstring( m_state, id.data(), id.size() );
+	nlua_pushstringview( m_state, id );
 	lua_pushnil( m_state );
 	lua_rawset( m_state, -3 );
