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

Function push_count_history

plugins/workflow.cpp:1334–1351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1332}
1333
1334static void push_count_history(lua_State *L, ItemConstraint *icv)
1335{
1336 size_t hsize = icv->history_size();
1337
1338 lua_createtable(L, hsize, 0);
1339
1340 for (size_t i = 0; i < hsize; i++)
1341 {
1342 lua_createtable(L, 0, 4);
1343
1344 Lua::SetField(L, icv->history_amount(i), -1, "cur_amount");
1345 Lua::SetField(L, icv->history_count(i), -1, "cur_count");
1346 Lua::SetField(L, icv->history_inuse_amount(i), -1, "cur_in_use_amount");
1347 Lua::SetField(L, icv->history_inuse_count(i), -1, "cur_in_use_count");
1348
1349 lua_rawseti(L, -2, i+1);
1350 }
1351}
1352
1353static void push_constraint(lua_State *L, ItemConstraint *cv)
1354{

Callers 2

listConstraintsFunction · 0.85
getCountHistoryFunction · 0.85

Calls 8

lua_createtableFunction · 0.85
SetFieldFunction · 0.85
lua_rawsetiFunction · 0.85
history_sizeMethod · 0.80
history_amountMethod · 0.80
history_countMethod · 0.80
history_inuse_amountMethod · 0.80
history_inuse_countMethod · 0.80

Tested by

no test coverage detected