| 1015 | } |
| 1016 | |
| 1017 | void SetContextValue(HContext context) |
| 1018 | { |
| 1019 | assert(context != 0x0); |
| 1020 | lua_State* L = context->m_LuaState; |
| 1021 | |
| 1022 | DM_LUA_STACK_CHECK(L, -2); |
| 1023 | |
| 1024 | lua_rawgeti(L, LUA_REGISTRYINDEX, context->m_ContextTableRef); |
| 1025 | // [-3] key |
| 1026 | // [-2] value |
| 1027 | // [-1] context table |
| 1028 | |
| 1029 | assert(lua_type(L, -1) == LUA_TTABLE); |
| 1030 | |
| 1031 | lua_insert(L, -3); |
| 1032 | // [-3] context table |
| 1033 | // [-2] key |
| 1034 | // [-1] value |
| 1035 | |
| 1036 | lua_settable(L, -3); |
| 1037 | // [-1] context table |
| 1038 | |
| 1039 | lua_pop(L, 1); |
| 1040 | } |
| 1041 | |
| 1042 | void GetContextValue(HContext context) |
| 1043 | { |