27 posts
Posted 20 December 2012 - 05:11 PM
Hi guys, i need something like this:
I got obsidian in slot nº16 and i need to see if obsidian is in other slots…
Somebody can help?
Merry Christmas
1054 posts
Posted 20 December 2012 - 05:19 PM
local function getSlots(slotNum)
local slots = {}
turtle.select(slotNum)
for i=1,16 do
if i~=slotNum and turtle.compareTo(i) then
table.insert(slots, i)
end
end
return slots
end
print("Slots containing the same item as slot 16:")
textutils.tabulate( getSlots(16) )
27 posts
Posted 20 December 2012 - 05:36 PM
Can you explain what is textutils.tabulate?
1054 posts
Posted 20 December 2012 - 05:38 PM
It prints a table of strings/numbers in a tabulated manner (like, the one next to the other, with spacing).