MCPcopy Create free account
hub / github.com/DFHack/dfhack / LookupTypeInfo

Method LookupTypeInfo

library/LuaWrapper.cpp:111–133  ·  view source on GitHub ↗

* Look up the key on the stack in DFHACK_TYPETABLE; * if found, put result on the stack and return true. */

Source from the content-addressed store, hash-verified

109 * if found, put result on the stack and return true.
110 */
111bool 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
135void LuaWrapper::LookupInTable(lua_State *state, const void *id, LuaToken *tname)
136{

Callers

nothing calls this directly

Calls 2

lua_rawgetFunction · 0.85
LookupInTableFunction · 0.85

Tested by

no test coverage detected