Changeset 187 for trunk/src/object.cc
- Timestamp:
- 08/03/13 12:07:12 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/object.cc
r120 r187 16 16 17 17 object::object() 18 : m_root( nullptr ), m_id(), m_name(), m_uid(0), m_lua_index( -2), m_parent( nullptr ), m_children(), m_child_count(0)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) 19 19 { 20 20 } 21 21 22 22 object::object( root* aroot, const string& aid ) 23 : m_root( aroot ), m_id(aid), m_name(), m_uid( 0 ), m_lua_index( -2), m_parent( nullptr ), m_children(), m_child_count(0)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) 24 24 { 25 25 if ( m_root ) 26 26 { 27 27 uid_store* store = get_root()->get_uid_store(); 28 lua::state* state = get_root()->get_lua_state();29 28 if (store) 30 29 { 31 30 m_uid = store->insert( this ); 32 }33 if (state)34 {35 m_lua_index = state->register_object( this );36 31 } 37 32 } … … 195 190 db->create_type<object>("object").fields(fields); 196 191 } 192 193 void nv::object::register_with_lua( const char* lua_name /*= nullptr*/ ) 194 { 195 lua::state* state = get_root()->get_lua_state(); 196 if (state) 197 { 198 if ( lua_name != nullptr ) 199 { 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 }
Note: See TracChangeset
for help on using the changeset viewer.