robathome icon

ChestMon - server

robathome | PRO | 10/30/25 03:38:47 PM UTC (Edited) | 0 ⭐ | 438 👁️ | Never ⏰ | []
text |

610 B

|

None

|

0 👍

/

0 👎

local im = peripheral.find("inventoryManager") or error("no IM")
print("inv ready on protocol 'inv'")
rednet.open("left")
while true do
  local id,msg,proto = rednet.receive("inv", 10)
  if msg == "list" then
    local t = im.getItemsChest("north") or {}
    local out = {}
    for _,v in pairs(t) do
      local name = v.displayName or v.name or (v.item and v.item.displayName) or "?"
      local count = v.count or (v.item and v.item.count) or 0
      out[#out+1] = {name=name, count=count}
    end
    table.sort(out, function(a,b) return a.name<b.name end)
    rednet.send(id, out, "inv")
  end
end
  

Comments