Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs ~= 2 then
- print("Usage: move <u/d/l/r/f/b> <amount>")
- return
- end
- local function move(x)
- if x == "l" then
- turtle.turnLeft()
- elseif x == "f" then
- turtle.forward()
- elseif x == "r" then
- turtle.turnRight()
- elseif x == "b" then
- turtle.back()
- elseif x == "u" then
- turtle.up()
- elseif x == "d" then
- turtle.down()
- end
- end
- local d = tArgs[1]
- local n = tArgs[2]
- local function nlr(d,n)
- for i = 1, n do
- move(d)
- end
- end
- local function lr(d,n)
- move(d)
- dir="f"
- nlr(dir,n)
- end
- if d=="l" then
- lr(d,n)
- elseif d=="r" then
- lr(d,n)
- else
- nlr(d,n)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement