Changeset 163
- Timestamp:
- 07/15/13 23:43:00 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/lua/lua_state.hh
r162 r163 89 89 reference register_object( object * o ); 90 90 void unregister_object( object * o ); 91 void register_enum( type_database* db, const std::string& name, const std::string& prefix = std::string() ); 91 92 operator lua_State*() { return L; } 92 93 ~state(); -
trunk/src/lua/lua_state.cc
r162 r163 372 372 } 373 373 } 374 375 void lua::state::register_enum( type_database* db, const std::string& name, const std::string& prefix /*= std::string() */ ) 376 { 377 type_entry* et = db->get_type( name ); 378 379 for ( const auto& entry : et->enum_list ) 380 { 381 lua_pushinteger( L, entry.value ); 382 if ( prefix.empty() ) 383 { 384 lua_setglobal( L, entry.name.c_str() ); 385 } 386 else 387 { 388 lua_setglobal( L, ( prefix + entry.name ).c_str() ); 389 } 390 } 391 }
Note: See TracChangeset
for help on using the changeset viewer.