feat: change sum_items for stock ticker

This commit is contained in:
Emerson Rosen-Jones 2026-01-16 21:55:56 -05:00
parent ecb7ff7c40
commit 4481b8e7fa

View file

@ -71,9 +71,9 @@ end
-- logic
function sum_items (inv)
function sum_items (inv_f)
local result = {}
for _, item in pairs(inv.list()) do
for _, item in pairs(inv_f()) do
if result[item.name] == nil then result[item.name] = 0 end
result[item.name] = result[item.name] + item.count
end
@ -156,8 +156,9 @@ function print_counts (items)
end
while true do
local main_inv = peripheral.wrap(MAIN_TICKER)
-- 1. Sum items in inventory and organize by item type
local items = sum_items(peripheral.wrap(INVENTORY))
local items = sum_items(main_inv.stock)
-- print_counts(items)
-- 2. either work towards a desired distribution or create more resources