Razara

shuffle

Mar 17th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. tArgs = {...}
  2.  
  3. if #tArgs == 0 then
  4.     print("Invalid syntax: shuffle direction amount")
  5. elseif tArgs[1] == "right" or tArgs[1] == "left" then
  6. local amount = 1
  7. if #tArgs == 2 then
  8.  amount = tonumber(tArgs[2])
  9. end
  10.  
  11. if tArgs[1] == "left" then
  12. turtle.turnLeft()
  13. else
  14. turtle.turnRight()
  15. end
  16.  
  17. for i = 1,amount do
  18. while not turtle.forward() do end
  19. end
  20.  
  21. if tArgs[1] == "left" then
  22. turtle.turnRight()
  23. else
  24. turtle.turnLeft()
  25. end
  26.  
  27. end
Advertisement
Add Comment
Please, Sign In to add comment