More work on compacting-storage.lua

This commit is contained in:
Emerson Rosen-Jones 2025-09-14 13:28:05 -04:00
parent 09298d8b06
commit 1fc836d144

View file

@ -46,12 +46,13 @@ function sum_items (inv)
local result = {} local result = {}
for _, type in ipairs(ITEM_TYPES) do for _, type in ipairs(ITEM_TYPES) do
result[type] = {} result[type] = {}
for _, form in ipairs(PRIORITY) do
result[type][form] = 0
end
end end
for slot, item in pairs(inv.list()) do for slot, item in pairs(inv.list()) do
local type, form = item.name:match".-:(%l-)_(%l*)" local type, form = item.name:match".-:(%l-)_(%l*)"
if result[type][form] == nil then if type ~= nil and form ~= nil then
result[type][form] = item.count
else
result[type][form] = result[type][form] + item.count result[type][form] = result[type][form] + item.count
end end
end end