View difference between Paste ID: UvLs29n3 and JrFBPhYj
SHOW: | | - or go back to the newest paste.
1-
while not turtle.detect() do
1+
local tArgs = { ... }
2-
  turtle.forward()
2+
3
--predefine
4
local lumberjack
5-
turtle.dig()
5+
6-
print("Starting, turtle...")
6+
function lumberjack()
7-
turtle.forward()
7+
    while not turtle.detect() do
8
        turtle.forward()
9-
while turtle.detectUp() do
9+
    end
10-
  turtle.digUp()
10+
    turtle.dig()
11-
  turtle.up()
11+
    print("Starting, turtle...")
12
    turtle.forward()
13
    while turtle.detectUp() do
14-
while not turtle.detectUp() and not turtle.detectDown() do
14+
        turtle.digUp()
15-
  turtle.down()
15+
        turtle.up()
16
    end
17
    while not turtle.detectUp() and not turtle.detectDown() do
18
        turtle.down()
19
    end
20
end
21
22
if tArgs[1] == "help"
23
    print( "Usage: lumberjack <distance>" )
24
elseif #tArgs < 1 then
25
    lumberjack()
26
else
27
    for i=1,tonumber(tArgs[1]) do
28
        lumberjack()
29
    end
30
end
31
32
print ("Complete, Turtle.")