Ignore:
Timestamp:
07/23/15 08:30:41 (10 years ago)
Author:
epyon
Message:
  • local updates (string removal)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lua/lua_raw.cc

    r435 r437  
    77#include "nv/lua/lua_raw.hh"
    88
    9 #include "nv/stl/string.hh"
    10 
    11 std::string nlua_typecontent( lua_State* L, int idx )
     9nv::string_view nlua_typecontent( lua_State* L, int idx )
    1210{
    1311        int type = lua_type( L, idx );
     
    1917        //case LUA_TLIGHTUSERDATA       : return std::to_string( nv::uint64( lua_touserdata( L, idx ) ) );
    2018        //case LUA_TNUMBER              : return std::to_string( lua_tonumber( L, idx ) );
    21         case LUA_TSTRING                : return lua_tostring( L, idx );
     19        // TODO: copy to buffer?
     20        case LUA_TSTRING                : return nlua_tostringview( L, idx );
    2221        case LUA_TTABLE             : return "TABLE";
    2322        case LUA_TFUNCTION              : return "FUNCTION";
     
    2625        default : break;
    2726        }
    28         char buffer_data[64];
     27        static char buffer_data[64];
    2928        nv::array_ref< char > buffer( buffer_data, 64 );
    3029        if ( type == LUA_TLIGHTUSERDATA || type == LUA_TUSERDATA )
    3130        {
    3231                size_t l = nv::uint64_to_buffer( buffer, nv::uint64( lua_touserdata( L, idx ) ) );
    33                 return std::string( buffer_data, l );
     32                return nv::string_view( buffer.data(), buffer.size() );
    3433        }
    3534        else if ( type == LUA_TNUMBER )
    3635        {
    3736                size_t l = nv::f64_to_buffer( buffer, lua_tonumber( L, idx ) );
    38                 return std::string( buffer_data, l );
     37                return nv::string_view( buffer.data(), buffer.size() );
    3938        }
    4039        return "UNKNOWN!";
Note: See TracChangeset for help on using the changeset viewer.