Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to place torch --
- function placeTorch() -- Optionally add functionality to place torch when no torch can be placed
- local torch = false
- for i = 1, 16 do -- loop through the slots
- turtle.select(i) -- change to the slot
- local x = turtle.getItemDetail(i)
- if(x ~= nil) then
- local istr = string.sub(x.name,string.find(x.name,":",0)+1)
- if(istr == "torch") then
- if(turtle.place()) then
- torch = true
- turtle.select(1)
- end
- end
- end
- end
- turtle.select(1)
- return torch
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement