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

(HELP) When I Use my Api I Get This:

Started by con2000, 16 April 2012 - 12:49 AM
con2000 #1
Posted 16 April 2012 - 02:49 AM
lua:43: attempt to call nil.

I Used function bedrock()



my api:



function getTree()
x = 0

while turtle.detect() == true do
turtle.dig()
turtle.digUp()
turtle.up()
x=x+1
end


while turtle.detectDown() == false do
turtle.down()
end

print ("The Tree Was "..x.." Chunks Big!")
end


function bedrock()

while turtle.detectDown() do
x = 0
turtle.digDown()
turtle.down()
x=x+1
end

while turtle.detectDown() == false do
turtle.up
end

while turtle.detect() == true do
print ("I Dug "..x.." spaces!")
end
Luanub #2
Posted 16 April 2012 - 08:21 AM
Missed ()'s for the turtle.up. Everything else looks good from what I see(you are missing an end for the function bedrock but it looks like you may have missed it in the copy??).

Make sure the API is loaded and that you are calling the function correctly apiname.bedrock().

You can type apis from the terminal to see if it is loaded. If not make sure the following is in either the startup file, the beginning of the program or simply type it in the lua shell os.loadAPI("apiname"). Make sure to use the absolute path when loading the API.
con2000 #3
Posted 16 April 2012 - 11:01 AM
Thanks, but now i feel really… really… REALLY…Stupid…Thanks. :)/>/>

JK