* Check if the object and metatable are a valid DF reference or type. */
| 400 | * Check if the object and metatable are a valid DF reference or type. |
| 401 | */ |
| 402 | static bool is_valid_metatable(lua_State *state, int objidx, int metaidx) |
| 403 | { |
| 404 | // Verify object type validity |
| 405 | if (lua_isuserdata(state, objidx)) |
| 406 | { |
| 407 | lua_pushvalue(state, metaidx); |
| 408 | lua_rawget(state, UPVAL_TYPETABLE); |
| 409 | } |
| 410 | else |
| 411 | { |
| 412 | lua_pushvalue(state, objidx); |
| 413 | LookupInTable(state, &DFHACK_TYPEID_TABLE_TOKEN); |
| 414 | } |
| 415 | |
| 416 | bool ok = !lua_isnil(state, -1); |
| 417 | lua_pop(state, 1); |
| 418 | return ok; |
| 419 | } |
| 420 | |
| 421 | bool Lua::IsDFNull(lua_State *state, int val_index) |
| 422 | { |
no test coverage detected