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

Function items_getOuterContainerRef

library/LuaApi.cpp:2550–2571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2548};
2549
2550static int items_getOuterContainerRef(lua_State *state)
2551{
2552 auto ref = Items::getOuterContainerRef(Lua::CheckDFObject<df::item>(state, 1));
2553 lua_newtable(state);
2554 Lua::TableInsert(state, "type", ref.type);
2555
2556 switch (ref.type)
2557 {
2558 case specific_ref_type::UNIT:
2559 Lua::TableInsert(state, "object", ref.data.unit);
2560 break;
2561 case specific_ref_type::ITEM_GENERAL:
2562 Lua::TableInsert(state, "object", (df::item*)ref.data.object);
2563 break;
2564 case specific_ref_type::VERMIN_EVENT:
2565 Lua::TableInsert(state, "object", ref.data.vermin);
2566 break;
2567 default:
2568 Lua::TableInsert(state, "object", NULL);
2569 }
2570 return 1;
2571}
2572
2573static int items_getContainedItems(lua_State *state) {
2574 vector<df::item*> pvec;

Callers

nothing calls this directly

Calls 1

TableInsertFunction · 0.85

Tested by

no test coverage detected