| 1040 | } |
| 1041 | |
| 1042 | void GetContextValue(HContext context) |
| 1043 | { |
| 1044 | assert(context != 0x0); |
| 1045 | lua_State* L = context->m_LuaState; |
| 1046 | |
| 1047 | DM_LUA_STACK_CHECK(L, 0); |
| 1048 | |
| 1049 | lua_rawgeti(L, LUA_REGISTRYINDEX, context->m_ContextTableRef); |
| 1050 | // [-2] key |
| 1051 | // [-1] context table |
| 1052 | |
| 1053 | if (lua_type(L, -1) != LUA_TTABLE) |
| 1054 | { |
| 1055 | lua_pop(L, 2); |
| 1056 | lua_pushnil(L); |
| 1057 | // [-1] LUA_NIL |
| 1058 | return; |
| 1059 | } |
| 1060 | |
| 1061 | lua_insert(L, -2); |
| 1062 | // [-2] context table |
| 1063 | // [-1] key |
| 1064 | lua_gettable(L, -2); |
| 1065 | // [-2] context table |
| 1066 | // [-1] value |
| 1067 | |
| 1068 | lua_remove(L, -2); |
| 1069 | // [-1] value |
| 1070 | } |
| 1071 | |
| 1072 | static void GetInstanceContextTable(lua_State* L) |
| 1073 | { |