Changeset 217 for trunk/src/object.cc


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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/object.cc

    r187 r217  
    1616
    1717object::object()
    18         : m_root( nullptr ), m_id(), m_name(), m_uid(0), m_lua_index(lua::ref_none), m_parent( nullptr ), m_children(), m_child_count(0)
     18        : m_root( nullptr )
     19        , m_id()
     20        , m_name()
     21        , m_uid(0)
     22        , m_lua_index(lua::ref_none)
     23        , m_lua_proto_index(lua::ref_none)
     24        , m_parent( nullptr )
     25        , m_children()
     26        , m_child_count(0)
    1927{
    2028}
    2129
    2230object::object( root* aroot, const string& aid )
    23         : m_root( aroot ), m_id(aid), m_name(), m_uid( 0 ), m_lua_index(lua::ref_none), m_parent( nullptr ), m_children(), m_child_count(0)
     31        : m_root( aroot )
     32        , m_id( aid )
     33        , m_name()
     34        , m_uid(0)
     35        , m_lua_index(lua::ref_none)
     36        , m_lua_proto_index(lua::ref_none)
     37        , m_parent( nullptr )
     38        , m_children()
     39        , m_child_count(0)
    2440{
    2541        if ( m_root )
     
    191207}
    192208
    193 void nv::object::register_with_lua( const char* lua_name /*= nullptr*/ )
     209void nv::object::register_with_lua( const char* lua_name, const char* storage )
    194210{
    195211        lua::state* state = get_root()->get_lua_state();
     
    198214                if ( lua_name != nullptr )
    199215                {
    200                         m_lua_index = state->register_object( this, lua_name );
    201                 }
    202                 else
    203                 {
    204                         m_lua_index = state->register_object( this );
    205                 }
    206         }
    207 }
     216                        m_lua_index       = state->register_object( this, lua_name );
     217                }
     218                if ( storage != nullptr )
     219                {
     220                        m_lua_proto_index = state->register_proto( this, storage );
     221                }
     222        }
     223}
Note: See TracChangeset for help on using the changeset viewer.