I have created a small program that asks for the length width and heights that you wish a mining turtle to mine. When I run it in the advanced computer though, It lets me prompt for the length, width and height but then I get an error. The error is as follows:
miner:39: attempt to index ? ( a nil value)
Here is my code:
term.clear()
term.setCursorPos(1,1)
write("Length:")
length = read()
print()
write("Confirm:")
ul = read()
print()
write("Width:")
width = read()
print()
write("Confirm:")
uw = read()
print()
write("Height:")
height = read()
print()
write("Confirm:")
uh = read()
print()
local totcount = ul + uw + uh
local subcount = 0
function Length()
repeat
turtle.dig()
turtle.forward()
length = length - 1
subcount = subcount + 1
until length == 0
length = ul
end
function Width()
repeat
turtle.dig()
turtle.forward()
width = width - 1
subcount = subcount + 1
until width == 0
width = uw
end
function Height()
turtle.digDown()
turtle.down()
height = height - 1
subcount = subcount + 1
end
function Turn()
turtle.turnRight()
end
repeat
Length()
Turn()
Width()
Turn()
Length()
Turn()
Width()
Turn()
Height()
until subcount == totcount