Ignore:
Timestamp:
04/29/15 14:53:06 (10 years ago)
Author:
epyon
Message:
  • fixed string_ref constructor
  • implementing string_ref usage in lua: lua_nova string usage optimized lua_values string_ref entries
File:
1 edited

Legend:

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

    r319 r358  
    7575}
    7676
     77void nv::lua::detail::push_string_ref( lua_State *L, string_ref s )
     78{
     79        lua_pushlstring( L, s.data(), s.size() );
     80}
     81
    7782void nv::lua::detail::push_pointer ( lua_State *L, void* p )
    7883{
     
    108113std::string nv::lua::detail::to_string  ( lua_State *L, int index )
    109114{
    110         return lua_tostring( L, index );
     115        size_t length = 0;
     116        const char* result = lua_tolstring( L, index, &length );
     117        return std::string( result, length );
    111118}
    112119
    113120const char* nv::lua::detail::to_cstring ( lua_State *L, int index )
    114121{
    115         return lua_tostring( L, index );
     122        return lua_tolstring( L, index, nullptr );
     123}
     124
     125nv::string_ref nv::lua::detail::to_string_ref( lua_State *L, int index )
     126{
     127        size_t length = 0;
     128        const char* result = lua_tolstring( L, index, &length );
     129        return string_ref( result, length );
    116130}
    117131
Note: See TracChangeset for help on using the changeset viewer.