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_nova.cc

    r323 r358  
    8383                lua_pushvalue( L, itype );
    8484                lua_pushvalue( L, iid );
    85                 lua_pushstring( L, "." );
     85                lua_pushliteral( L, "." );
    8686                lua_pushvalue( L, ifield );
    8787                lua_concat( L, 3 );
     
    292292{
    293293        // storage.__counter++
    294         lua_pushstring( L, "__counter" );
     294        lua_pushliteral( L, "__counter" );
    295295        lua_pushvalue( L, -1 );
    296296        lua_rawget( L, 1 );
     
    303303
    304304        // element.nid = __counter
    305         lua_pushstring( L, "nid" );
     305        lua_pushliteral( L, "nid" );
    306306        lua_pushinteger( L, count );
    307307        lua_rawset( L, 2 );
     
    322322
    323323        // element.id = element.id
    324         lua_pushstring( L, "id" );
     324        lua_pushliteral( L, "id" );
    325325        lua_rawget( L, 2 );
    326326        if ( lua_isnil( L, -1 ) )
     
    413413
    414414        lua_pushvalue( L, 1 );
    415         lua_pushstring( L, "." );
     415        lua_pushliteral( L, "." );
    416416        lua_pushvalue( L, 2 );
    417417        lua_concat( L, 3 ); // new ident index 5
     
    449449
    450450        lua_pushvalue( L, 1 );
    451         lua_pushstring( L, "." );
     451        lua_pushliteral( L, "." );
    452452        lua_pushvalue( L, 2 );
    453453        lua_concat( L, 3 ); // new ident index 6
     
    579579        if ( lua_type( L, 1 ) == LUA_TSTRING )
    580580        {
     581                // TODO: Optimzie
    581582                lua_getglobal( L, lua_tostring( L, 1 ) );
    582583                lua_replace( L, 1 );
     
    809810}
    810811
    811 void nv::lua::register_storage( state* a_state, const string& name, const string& constructor_name )
     812void nv::lua::register_storage( state* a_state, string_ref name, string_ref constructor_name )
    812813{
    813814        // TODO: error checking
     
    816817        // TODO: check if nova is loaded
    817818        lua_pushcfunction( L, nova_register_storage );
    818         lua_pushstring( L, name.c_str() );
     819        lua_pushlstring( L, name.data(), name.size() );
    819820        lua_call( L, 1, 1 );
    820         lua_setglobal( L, constructor_name.c_str() );
     821        lua_setglobal( L, constructor_name.data() );
    821822        lua_settop( L, stack );
    822823}
Note: See TracChangeset for help on using the changeset viewer.