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

Attempt to call nil error

Started by xebryus, 28 June 2016 - 11:51 PM
xebryus #1
Posted 29 June 2016 - 01:51 AM
Hey Guys,

I'm trying to use code I found off of an imgur page. All I'm really trying to do is make lights in my house illuminate when I walk down the stairs.

Here is the pastebin where the code is: http://pastebin.com/N5TgZh0x

After booting it up, I'm getting the "'program':17: attempt to call nil"

I'm trying to find the issue, but can't seem to for the life of me. Any help is appreciated. Thanks!
eniallator #2
Posted 29 June 2016 - 10:47 AM
it seems like it needs an open peripheral's sensor block to the left of the computer, do you have one there?
xebryus #3
Posted 29 June 2016 - 03:02 PM
it seems like it needs an open peripheral's sensor block to the left of the computer, do you have one there?

Yeah I messed with the config to suite where I have the sensor. Sensor I set to right and red stone conduit bottom. What's odd is that when I get the error, the red stone signal stays on permanently no matter my player location as well.
Bomb Bloke #4
Posted 30 June 2016 - 03:22 AM
What's odd is that when I get the error, the red stone signal stays on permanently no matter my player location as well.

That suggests you meant line 27, not 17.

Either way you're trying to call a function that doesn't actually exist. All your ComputerCraft calls check out as ok, so it'll be one of the OpenPeripheral sensor functions that isn't present (likely because the function names tend to change depending on the version of OpenPeripheral you're using).

You can probably use this to help you confirm the correct usage of your sensor.