More work on compacting-storage.lua
This commit is contained in:
parent
09298d8b06
commit
1fc836d144
1 changed files with 4 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue