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 = {}
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue