From 1fc836d144fb743864f7fb0078232267ed370e7f Mon Sep 17 00:00:00 2001 From: Emerson Rosen-Jones Date: Sun, 14 Sep 2025 13:28:05 -0400 Subject: [PATCH] More work on compacting-storage.lua --- compacting-storage.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compacting-storage.lua b/compacting-storage.lua index 3c96bfa..b3edf3f 100644 --- a/compacting-storage.lua +++ b/compacting-storage.lua @@ -46,12 +46,13 @@ function sum_items (inv) local result = {} for _, type in ipairs(ITEM_TYPES) do result[type] = {} + for _, form in ipairs(PRIORITY) do + result[type][form] = 0 + end end for slot, item in pairs(inv.list()) do local type, form = item.name:match".-:(%l-)_(%l*)" - if result[type][form] == nil then - result[type][form] = item.count - else + if type ~= nil and form ~= nil then result[type][form] = result[type][form] + item.count end end