Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local rotation = tArgs[1]
- if rotation == nil then
- print("Usage: rotate <amount>")
- return -1
- end
- rotation = tonumber(rotation)
- local direction
- if rotation == 0 then
- print ("Rotating nowhere")
- return 0
- elseif rotation > 0 then
- direction = "right "
- elseif rotation < 0 then
- direction = "left "
- end
- print("Rotating ", direction, rotation, " times")
- rotate(rotation)
- function rotate(arg)
- if arg < 0 then
- rotation = -arg
- for r = 0, rotation-1, 1 do
- turtle.turnLeft()
- end
- elseif arg > 0 then
- rotation = arg
- for r = 0, rotation-1, 1 do
- turtle.turnRight()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement