Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---- END FUNCTIONS
- function getItemInfoFromStorate(item, storage)
- local size = storage.size()
- local itemList = storage.list()
- local positions = {}
- local nbrOfItems = 0
- modName, itemName, itemDamage = item:match("(%w+):(%w+):?(%w+)?")
- if itemDamage == nil then
- itemDamage = "0"
- end
- for i = 1,size,1 do
- if itemList[i] ~= nil then
- if itemList[i]["name"] == modName .. ":" .. itemName and tostring(itemList[i]["damage"]) == itemDamage then
- table.insert(positions, i)
- nbrOfItems = nbrOfItems + itemList[i]["count"]
- end
- end
- end
- return {positions = positions, nbrOfItems = nbrOfItems}
- end
- local stuff = getItemInfoFromStorate("botania:livingrock:1", peripheral.wrap("right"))
- write (stuff.positions[1], nbrOfItems)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement