0

I'm using the Inventory Manager from Advanced Peripherals, and I'm trying to make a script that transfers my inventory to a chest but keeps the positioning of all the items. The getItems() function is supposed to return a table in which the keys are the slot numbers containing items and the values are the data for the items in those slots. However, that's not what I seem to be getting. The table returned by getItems() doesn't seem to record the slot numbers anywhere - the keys are just numbers increasing from 1 to the amount of filled slots in my inventory, no matter where the items are located.

local inv = peripheral.find("inventoryManager")
local invTable = inv.getItems()
for slot,item in pairs(invTable):
    print(slot..": "..item.name.." x"..item.count)
end

1 Answers1

0

UPDATE: It turns out that in the latest version of Advanced Peripherals, the slot number is stored in item.slot rather than as the key for the entry. This change seems to be entirely undocumented, so hopefully this post will be helpful for others encountering the same issue.