Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function arrComp (a,b)
- return textutils.serialise(a) == textutils.serialise(b)
- end
- function findEmp ()
- for i=1,16 do
- if not turtle.getItemDetail(i) then
- return i
- end
- end
- end
- function findI (name)
- for slot in invItr() do
- if slot.it then
- if slot.it.name == name then
- return slot.idx
- end
- end
- end
- return 0
- end
- function mkItr(tab)
- local i=0
- local n = #tab
- return function()
- i=i+1
- if i <= n then return tab[i] end
- end
- end
- local function invTab ()
- local inv = {}
- for i=1,16 do
- local item = turtle.getItemDetail(i)
- inv[i]={idx=i,it=item}
- end
- return inv
- end
- function invItr ()
- return mkItr(invTab())
- end
- function getInv ()
- inv = {}
- i=1
- for slot in invItr() do
- if slot.it then
- inv[i]=slot.it
- i=i+1
- end
- end
- return inv
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement