| 1410 | } |
| 1411 | |
| 1412 | void ResolveInInstance(lua_State* L, int ref) |
| 1413 | { |
| 1414 | DM_LUA_STACK_CHECK(L, 1); |
| 1415 | |
| 1416 | GetInstanceContextTable(L); |
| 1417 | // [-1] instance context table or LUA_NIL |
| 1418 | |
| 1419 | if (lua_type(L, -1) != LUA_TTABLE) |
| 1420 | { |
| 1421 | lua_pop(L, 1); |
| 1422 | |
| 1423 | lua_pushnil(L); |
| 1424 | // [-1] LUA_NIL |
| 1425 | return; |
| 1426 | } |
| 1427 | // [-1] instance context table |
| 1428 | |
| 1429 | lua_rawgeti(L, -1, ref); |
| 1430 | // [-2] instance context table |
| 1431 | // [-1] value |
| 1432 | |
| 1433 | lua_insert(L, -2); |
| 1434 | // [-2] value |
| 1435 | // [-1] instance context table |
| 1436 | |
| 1437 | lua_pop(L, 1); |
| 1438 | // [-1] value |
| 1439 | } |
| 1440 | |
| 1441 | |
| 1442 | struct LuaCallstackCtx |