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

Function dfhack_pen_index

library/LuaApi.cpp:802–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

800}
801
802static int dfhack_pen_index(lua_State *L)
803{
804 lua_settop(L, 2);
805 luaL_checktype(L, 1, LUA_TUSERDATA);
806
807 // check metatable
808 if (!lua_getmetatable(L, 1))
809 luaL_argerror(L, 1, "must be a pen");
810 lua_pushvalue(L, 2);
811 lua_rawget(L, -2);
812 if (!lua_isnil(L, -1))
813 return 1;
814
815 // otherwise read from the mirror table, creating it if necessary
816 lua_settop(L, 2);
817 get_pen_mirror(L, 1);
818 lua_pushvalue(L, 2);
819 lua_rawget(L, -2);
820 return 1;
821}
822
823static int pen_pnext(lua_State *L)
824{

Callers

nothing calls this directly

Calls 7

lua_settopFunction · 0.85
luaL_checktypeFunction · 0.85
lua_getmetatableFunction · 0.85
luaL_argerrorFunction · 0.85
lua_pushvalueFunction · 0.85
lua_rawgetFunction · 0.85
get_pen_mirrorFunction · 0.85

Tested by

no test coverage detected