diff options
-rw-r--r-- | storage.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/storage.lua b/storage.lua index f587f56..87b8743 100644 --- a/storage.lua +++ b/storage.lua @@ -1,4 +1,10 @@ -local M = peripheral.find"monitor" +--local M = peripheral.find"monitor" + +local ok,chestnames = pcall(require,"chestnames") +if not ok then chestnames = {} end +chestnames = chestnames or {} +setmetatable(chestnames, {__index=function(t,k) return k end}) + local sides = {} for _,s in ipairs(redstone.getSides()) do sides[s] = true end @@ -28,10 +34,10 @@ end local function search(query) local chests = scan() for chname,chest in pairs(chests) do - for i=1,chest.size do - local it = chest.content[i] + for slot=1,chest.size do + local it = chest.content[slot] if it and it.name:lower():find(query) then - print(it.name,"x"..it.count) + print(it.name,"x"..it.count,chestnames[chname]) end end end |