Changeset 217 for trunk/src/lua


Ignore:
Timestamp:
09/10/13 18:11:39 (12 years ago)
Author:
epyon
Message:
  • lua/nova - almost complete reimplementation of "core" from FPC Valkyrie
  • lua/state - nova loaded by default
  • object - prototype reference caching
Location:
trunk/src/lua
Files:
1 added
1 edited

Legend:

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

    r216 r217  
    88
    99#include "nv/lua/lua_raw.hh"
     10#include "nv/lua/lua_nova.hh"
    1011#include "nv/logging.hh"
    1112#include "nv/string.hh"
     
    235236                        lib->func( m_state );
    236237                }
     238                register_nova( this );
    237239        }
    238240
     
    337339        }
    338340        deep_pointer_copy( -1, o );
     341        return luaL_ref( m_state, LUA_REGISTRYINDEX );
     342}
     343
     344lua::reference lua::state::register_proto( object * o, const char* storage )
     345{
     346        stack_guard guard( this );
     347        lua_getglobal( m_state, storage );
     348        if ( lua_isnil( m_state, -1 ) )
     349        {
     350                NV_THROW( runtime_error, std::string( storage ) + " storage not registered!" );
     351        }
     352        lua_getfield( m_state, -1, o->get_id().c_str() );
     353        if ( lua_isnil( m_state, -1 ) )
     354        {
     355                NV_THROW( runtime_error, std::string( o->get_id() ) + " not found in " + std::string( storage ) + " storage!" );
     356        }
    339357        return luaL_ref( m_state, LUA_REGISTRYINDEX );
    340358}
Note: See TracChangeset for help on using the changeset viewer.