LayZee

ComputerCraft lzMove

Dec 26th, 2013
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.42 KB | None | 0 0
  1. os.loadAPI('lz')
  2.  
  3. lz.load('turtle', 't')
  4.  
  5. local arguments = {...}
  6.  
  7. assert(#arguments > 0, 'No direction passed')
  8.  
  9. local verify = function(direction)
  10.   local valid = {
  11.     up = true,
  12.     down = true,
  13.     forward = true
  14.   }
  15.  
  16.   assert(valid[direction], 'Invalid direction \'' .. direction .. '\'')
  17. end
  18.  
  19. local direction = arguments[1]
  20. verify(direction)
  21.  
  22. local steps = arguments[2] or 1
  23.  
  24. lz.t[direction](steps)
Add Comment
Please, Sign In to add comment