| 1287 | } |
| 1288 | |
| 1289 | bool SetInstanceContextValue(lua_State* L) |
| 1290 | { |
| 1291 | // [-2] key |
| 1292 | // [-1] value |
| 1293 | |
| 1294 | DM_LUA_STACK_CHECK(L, -2); |
| 1295 | |
| 1296 | GetInstanceContextTable(L); |
| 1297 | // [-3] key |
| 1298 | // [-2] value |
| 1299 | // [-1] instance context table or LUA_NIL |
| 1300 | |
| 1301 | if (lua_type(L, -1) != LUA_TTABLE) |
| 1302 | { |
| 1303 | lua_pop(L, 3); |
| 1304 | return false; |
| 1305 | } |
| 1306 | // [-3] key |
| 1307 | // [-2] value |
| 1308 | // [-1] instance context table |
| 1309 | |
| 1310 | lua_insert(L, -3); |
| 1311 | // [-3] instance context table |
| 1312 | // [-2] key |
| 1313 | // [-1] value |
| 1314 | |
| 1315 | lua_settable(L, -3); |
| 1316 | // [-1] instance context table |
| 1317 | |
| 1318 | lua_pop(L, 1); |
| 1319 | return true; |
| 1320 | } |
| 1321 | |
| 1322 | void GetInstanceContextValue(lua_State* L) |
| 1323 | { |