* Look up the key on the stack in DFHACK_TYPETABLE; * if found, put result on the stack and return true. */
| 109 | * if found, put result on the stack and return true. |
| 110 | */ |
| 111 | bool LuaWrapper::LookupTypeInfo(lua_State *state, bool in_method) |
| 112 | { |
| 113 | // stack: [lookup key] |
| 114 | |
| 115 | if (in_method) |
| 116 | { |
| 117 | lua_rawget(state, UPVAL_TYPETABLE); |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | LookupInTable(state, &DFHACK_TYPETABLE_TOKEN); |
| 122 | } |
| 123 | |
| 124 | // stack: [info] |
| 125 | |
| 126 | if (lua_isnil(state, -1)) |
| 127 | { |
| 128 | lua_pop(state, 1); |
| 129 | return false; |
| 130 | } |
| 131 | else |
| 132 | return true; |
| 133 | } |
| 134 | |
| 135 | void LuaWrapper::LookupInTable(lua_State *state, const void *id, LuaToken *tname) |
| 136 | { |
nothing calls this directly
no test coverage detected