Changeset 7653 in orxonox.OLD for branches/script_engine/src/lib/script_engine/This.h
- Timestamp:
- May 17, 2006, 7:55:59 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/lib/script_engine/This.h
r7645 r7653 6 6 7 7 // Sets the "this" global table that scripts use 8 namespace OrxScript 9 { 8 10 9 class LuaThis10 {11 class LuaThis 12 { 11 13 public: 12 14 LuaThis (LuaVirtualMachine& vm, int iRef) : oldReference (0), virtualMachine (vm) … … 15 17 if (vm.isOk ()) 16 18 { 17 19 // Save the old "this" table 18 20 lua_getglobal (state, "this"); 19 21 oldReference = luaL_ref (state, LUA_REGISTRYINDEX); 20 22 21 23 // replace it with our new one 22 24 lua_rawgeti(state, LUA_REGISTRYINDEX, iRef); 23 25 lua_setglobal (state, "this"); … … 30 32 if (oldReference > 0 && virtualMachine.isOk ()) 31 33 { 32 34 // Replace the old "this" table 33 35 lua_rawgeti(state, LUA_REGISTRYINDEX, oldReference); 34 36 lua_setglobal (state, "this"); … … 41 43 int oldReference; 42 44 LuaVirtualMachine& virtualMachine; 43 };44 45 }; 46 } 45 47 #endif // __THIS_H__
Note: See TracChangeset
for help on using the changeset viewer.