Posted 09 February 2013 - 11:23 AM
Title: Custom Mining Program Won't Work
Here is my code-
The error i get is ":12: attempt to call nil" when i run it.
I've squashed several other bugs, but this one has had me stumped for a few days now.
Any idea?
Here is my code-
--Variables
t = ("turtle")
local Args = {...}
local level = tonumber (Args[1])
local counter = 0
--Functions
function minedown()
while counter ~= level do
t.dig()
t.turnLeft()
t.dig()
t. turnLeft
t.dig()
t.turnLeft()
t.dig()
t.turnLeft()
t.digUp()
t.up()
counter = counter - 1
end
end
function mineup()
while counter ~= 0 do
t.dig()
t.turnLeft()
t.dig()
t. turnLeft
t.dig()
t.turnLeft()
t.dig()
t.turnLeft()
t.digDown()
t.down()
counter = counter + 1
end
print("-Finished-")
end
--Code
if counter < level then
print("Mining to level ", level)
end
if counter >= level then
t.forward()
t.dig()
t.forward()
t.dig()
t.forward()
mineup()
else
minedown()
end
—————–The error i get is ":12: attempt to call nil" when i run it.
I've squashed several other bugs, but this one has had me stumped for a few days now.
Any idea?
Edited by