Cakejoke

[CC] COS-CJE go program

Dec 22nd, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local tArgs = {...}
  2. local direction = tArgs[1]
  3. local distance = tArgs[2]
  4.  
  5. if not direction then
  6.     iox.colorPrint("No direction given: forward, back, up or down", colors.red)
  7.     return
  8. elseif direction ~= "forward" and direction ~= "back" and direction ~= "up" and
  9.         direction ~= down then
  10.     iox.colorPrint("Invalid direction: "..direction..
  11.             ", use forward, back, up or down", colors.red)
  12.     return
  13. end
  14. if not distance then
  15.     distance = 1
  16. end
  17.  
  18. if direction == "forward" then
  19.     navigate.forward(distance)
  20. elseif direction == "back" then
  21.     navigate.back(distance)
  22. elseif direction == "up" then
  23.     navigate.up(distance)
  24. elseif direction == "down" then
  25.     navigate.down(distance)
  26. end
Advertisement
Add Comment
Please, Sign In to add comment