- Timestamp:
- 06/19/14 00:26:00 (11 years ago)
- Location:
- trunk/src/lua
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_map_area.cc
r207 r263 54 54 nv::map_area* nv::lua::detail::to_map_area( lua_State* L, int index ) 55 55 { 56 if ( lua_type( L, index ) == LUA_TTABLE ) 57 { 58 nv::map_area* o = nullptr; 59 if ( lua_istable( L , index ) ) 56 nv::map_area* o = nullptr; 57 if ( lua_istable( L , index ) ) 58 { 59 lua_pushstring( L, "__map_area_ptr" ); 60 lua_rawget( L, index ); 61 if ( lua_isuserdata( L, -1 ) ) 60 62 { 61 lua_pushstring( L, "__map_area_ptr" ); 62 lua_rawget( L, index ); 63 if ( lua_isuserdata( L, -1 ) ) 64 { 65 o = static_cast<nv::map_area*>( lua_touserdata( L, -1 ) ); 66 } 67 lua_pop( L, 1 ); 68 } 69 return o; 63 o = static_cast<nv::map_area*>( lua_touserdata( L, -1 ) ); 64 } 65 lua_pop( L, 1 ); 70 66 } 71 67 else … … 73 69 return *(nv::map_area**)luaL_checkudata( L, index, NLUA_MAP_AREA_METATABLE ); 74 70 } 71 return o; 75 72 } 76 73 … … 235 232 luaopen_map_area(L); 236 233 } 234 235 void nv::lua::register_map_area_instance( lua_State* L, int object_index, map_area* area ) 236 { 237 lua_rawgeti( L, LUA_REGISTRYINDEX, object_index ); 238 lua_pushstring( L, "__map_area_ptr" ); 239 lua_pushlightuserdata( L, (map_area*)area ); 240 lua_rawset( L, -3 ); 241 lua_pop( L, 1 ); 242 } -
trunk/src/lua/lua_state.cc
r262 r263 422 422 { 423 423 if ( object_index == ref_nil ) return; 424 stack_guard guard( this );425 424 lua_rawgeti( m_state, LUA_REGISTRYINDEX, object_index ); 426 425 lua_pushstring( m_state, metaname.c_str() );
Note: See TracChangeset
for help on using the changeset viewer.