Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local drawers = peripheral.wrap("top")
- local sieves = peripheral.wrap("bottom")
- local i = 1
- term.clear()
- while true do
- local drawerItems = drawers.list()
- term.setCursorPos(1, 1)
- if not next(sieves.list()) and next(drawerItems) then
- local items = {}
- for i, item in pairs (drawerItems) do
- item.slot = i
- table.insert(items, item)
- end
- table.sort(items, function(a, b)
- return a.slot < b.slot
- end)
- i = (i % #items) + 1 -- To ensure it doesn't get out of bounds (the + 1 is due to it decreasing the number by 1 (sort of))
- term.write("Pushed " .. drawers.pushItems("bottom", items[i].slot, 25) .. " " .. items[i].name .. " ")
- i = i + 1
- elseif not next(sieves.list()) then
- term.write("No input items ")
- else
- term.write("Items already in the output ")
- end
- sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement