# ErrorTest

May 19th, 2017
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. x, y, z, f = 0, 0, 0, 0
2.
3. function forward()
4.   if turtle.forward() then
5.     if f == 0 then
6.       x = x + 1
7.     elseif f == 1 then
8.       z = z + 1
9.     elseif f == 2 then
10.       x = x - 1
11.     elseif f == 3 then
12.       z = z - 1
13.     end
14.     return true
15.   end
16.   return false
17. end
18.
19. function back()
20.   if turtle.back() then
21.     if f == 0 then
22.       x = x - 1
23.     elseif f == 1 then
24.       z = z - 1
25.     elseif f == 2 then
26.       x = x + 1
27.     elseif f == 3 then
28.       z = z + 1
29.     end
30.     return true
31.   end
32.   return false
33. end
34.
35. function up()
36.   if turtle.up() then
37.     y = y + 1
38.     return true
39.   end
40.   return false
41. end
42.
43. function down()
44.   if turtle.down() then
45.     y = y - 1
46.     return true
47.   end
48.   return false
49. end
50.
51. function left()
52.   turtle.turnLeft()
53.   f = (f+3)%4
54. end
55.
56. function right()
57.   turtle.turnRight()
58.   f = (f+1)%4
59. end
60.
61. function home()
62.   while y ~= 0 do
63.     if y < 0 then
64.       turtle.digUp()
65.       up()
66.     elseif y > 0 then
67.       turtle.digDown()
68.       down()
69.     end
70.   end
71.   if z > 0 then
72.     while f ~= 3 do
73.       left()
74.     end
75.   elseif z < 0 then
76.     while f ~= 1 do
77.       left()
78.     end
79.   end
80.   while z ~= 0 do
81.     forward()
82.   end
83.   if x > 0 then
84.     while f ~= 2 do
85.       left()
86.     end
87.   elseif x < 0 then
88.     while f ~= 0 do
89.       left()
90.     end
91.   end
92.   while x ~= 0 do
93.     forward()
94.   end
95. end
96.
97. forward()
98. forward()
99. forward()
100. local c = "lenis pick"
101. c = c + 4