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

Function complex_enum_inext

library/LuaWrapper.cpp:1417–1434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1415}
1416
1417static int complex_enum_inext(lua_State *L)
1418{
1419 bool is_first = lua_isuserdata(L, 2);
1420 int64_t i = (is_first)
1421 ? ((enum_identity::ComplexData*)lua_touserdata(L, lua_upvalueindex(2)))->index_value_map[0]
1422 : luaL_checkint(L, 2);
1423 if (is_first || complex_enum_next_item_helper(L, i))
1424 {
1425 lua_pushinteger(L, i);
1426 lua_rawgeti(L, lua_upvalueindex(1), i);
1427 return 2;
1428 }
1429 else
1430 {
1431 lua_pushnil(L);
1432 return 1;
1433 }
1434}
1435
1436static int complex_enum_next_item(lua_State *L)
1437{

Callers

nothing calls this directly

Calls 6

lua_isuserdataFunction · 0.85
lua_touserdataFunction · 0.85
lua_pushintegerFunction · 0.85
lua_rawgetiFunction · 0.85
lua_pushnilFunction · 0.85

Tested by

no test coverage detected