function fillSlot(slot) -- finish the stack until turtle.getItemSpace(slot) == 0 -- repeat until stack is complete turtle.select(slot) -- select slot turtle.suck() -- try to fill slot if turtle.getItemSpace(slot) == 0 then -- if slot was filled turtle.suckDown() -- pick up all non matching items for i = 1, 16 do --empty all items except for kept slots if i == 1 or i == 4 or i == 13 or i == 15 or i == 16 then -- kept slots -- Do nothing else turtle.select(i) -- select non-kept slot turtle.drop() --place in chest end end else -- if slot was not filled for i = 1, 16 do --empty all items into "temporary holding area" except for kept slots if i == 1 or i == 4 or i == 13 or i == 15 or i == 16 then -- kept slots -- Do nothing else turtle.select(i) -- select non-kept slots turtle.dropDown() -- drop on floor (under turtle) end end end end end fillSlot(1)
The error is Line 2 'end' expected to close function, but i believe I have all the ends











