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

Attempt to call nil problem

Started by Neopherus, 29 January 2013 - 09:02 AM
Neopherus #1
Posted 29 January 2013 - 10:02 AM
Bit new to lua, but starting to get the hang of a few bits and pieces.
Trying to make a wallmaking program for a tunnel my quarry broke into, and my turtle keeps returning nil whenever I run it.
It works well untill after the checkslot() function.
Please have a look at my pastebin and tell me what part is calling nil. http://pastebin.com/5HTRxjEh
It's still in the testing phase, so not complete yet, just don't want to continue writing until I get this issue sorted out.
Thanks :)/>
Lyqyd #2
Posted 29 January 2013 - 10:42 AM
Split to new topic.
PixelToast #3
Posted 29 January 2013 - 10:50 AM
turtle.detectForward()
needs to be
turtle.detect()
Neopherus #4
Posted 29 January 2013 - 11:58 AM
turtle.detectForward()
needs to be
turtle.detect()

Thanks, that got me over the first problem. Now I get the "call nil" error after he places the first row of the wall and he just stands there staring at it.
Did a few tweaks, so here's the new PB: http://pastebin.com/HsM26b4Z
Gone over it a bunch of times, but I guess I can't see the forest through the trees or something. All help appreciated.
PixelToast #5
Posted 29 January 2013 - 12:19 PM
turtle.right()
needs to be
turtle.turnRight()

also, the full error would be helpful (it shows the line number)
Neopherus #6
Posted 29 January 2013 - 12:23 PM
Oh, right! Sorry.

"WallsL:39:Attempt to call nil"

Edit: Well I'll be damned. I see the forest lol. Tiny typo because I got used to replacing him outside of Lua. Thanks!