Advertisement
jkCBWPnet

Measure

Aug 8th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.28 KB | None | 0 0
  1. local function measure()
  2.     local d = 0
  3.     while not turtle.detect() do
  4.         if turtle.forward() then
  5.             d = d + 1
  6.         end
  7.     end
  8.     return d
  9. end
  10.  
  11. local distance = measure()
  12. turtle.turnRight()
  13. turtle.turnRight()
  14. for m = 1,distance do
  15.     turtle.forward()
  16. end
  17.  
  18. print(distance.." meters.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement