This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
fauxiss's profile picture

[Lua] attempt to index ? (a nil value)

Started by fauxiss, 11 January 2013 - 07:36 AM
fauxiss #1
Posted 11 January 2013 - 08:36 AM
this is a simple program that cuts down the trunk of the 3x3 rubber tree from red power. it gets 2 digs in then gives me this
3x3:18: attempt to index ? (a nil value)


x = 0
h = 0
function fuel()
    if turtle.getFuelLevel() < 10 then
	    turtle.select(16)
	    turtle.refuel(1)
	    turtle.select(1)
    end
end
function lane()
    fuel()
    turtle.turnLeft()
    turtle.dig()
    turtle.turnRight()
    turtle.turnRight()
    turrtle.dig()
    turtle.turnLeft()
end
function layer()
    lane()
    turtle.dig()
    turtle.forward()
    lane()
    turtle.dig()
    turtle.forward()
    lane()
    turtle.back()
    turtle.back()
end
fuel()
turtle.dig()
turtle.forward()
turtle.select(15)
while turtle.compareUp() do
    layer()
    fuel()
    turtle.digUp()
    turtle.up()
    h = h + 1
end
for x = 1, h do
    turtle.down()
end
GravityScore #2
Posted 11 January 2013 - 08:42 AM
function lane()
fuel()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
turrtle.dig()
turtle.turnLeft()
end

You spelt turtle wrong :P/>
ChunLing #3
Posted 11 January 2013 - 08:44 AM
"turrtle.dig()"

Ouch Ninja'd.
Edited on 11 January 2013 - 07:44 AM
fauxiss #4
Posted 11 January 2013 - 08:46 AM
oh oops, thanks. I guess the expression, you see what you want to see is true. lol.