| 271 | |
| 272 | |
| 273 | void *DFHack::Lua::CheckDFObject(lua_State *state, const type_identity *type, int val_index, bool exact_type) |
| 274 | { |
| 275 | check_valid_ptr_index(state, val_index); |
| 276 | |
| 277 | if (lua_isnil(state, val_index)) |
| 278 | return NULL; |
| 279 | if (lua_islightuserdata(state, val_index) && !lua_touserdata(state, val_index)) |
| 280 | return NULL; |
| 281 | |
| 282 | void *rv = get_object_internal(state, type, val_index, exact_type, false); |
| 283 | |
| 284 | if (!rv) |
| 285 | signal_typeid_error(NULL, state, type, "invalid pointer type; expected: {}", |
| 286 | val_index, false, true); |
| 287 | |
| 288 | return rv; |
| 289 | } |
| 290 | |
| 291 | /* |
| 292 | * Console I/O wrappers |
nothing calls this directly
no test coverage detected