| 1320 | } |
| 1321 | |
| 1322 | void GetInstanceContextValue(lua_State* L) |
| 1323 | { |
| 1324 | // [-1] key |
| 1325 | DM_LUA_STACK_CHECK(L, 0); |
| 1326 | |
| 1327 | GetInstanceContextTable(L); |
| 1328 | // [-2] key |
| 1329 | // [-1] instance context table or LUA_NIL |
| 1330 | |
| 1331 | if (lua_type(L, -1) != LUA_TTABLE) |
| 1332 | { |
| 1333 | lua_pop(L, 2); |
| 1334 | |
| 1335 | lua_pushnil(L); |
| 1336 | // [-1] LUA_NIL |
| 1337 | return; |
| 1338 | } |
| 1339 | // [-2] key |
| 1340 | // [-1] instance context table |
| 1341 | |
| 1342 | lua_insert(L, -2); |
| 1343 | // [-2] instance context table |
| 1344 | // [-1] key |
| 1345 | |
| 1346 | lua_gettable(L, -2); |
| 1347 | // [-2] instance context table |
| 1348 | // [-1] value |
| 1349 | |
| 1350 | lua_insert(L, -2); |
| 1351 | // [-2] value |
| 1352 | // [-1] instance context table |
| 1353 | |
| 1354 | lua_pop(L, 1); |
| 1355 | // [-1] value |
| 1356 | } |
| 1357 | |
| 1358 | int RefInInstance(lua_State* L) |
| 1359 | { |