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

Attempt To Index ? (A Nil Value)

Started by Beechey12, 17 August 2013 - 12:26 PM
Beechey12 #1
Posted 17 August 2013 - 02:26 PM
Hi

I'm trying to use Direwolf20's button api, when i download it from pastebin along with his demo program it will work perfectly well, but if i change the name of the button in the demo program it then say's "button:63: attempt to index ? (a nil value)".

I get this error when i click the button.

I'm really confused as to why this is happening so any help will be greatly appreciated.

the pastebin codes are:
button api: HRbMF1Eg
demo: xVmKfn2Y

Thankyou
Beechey
Lord_Spelunky #2
Posted 17 August 2013 - 02:52 PM
where is your monitor? change peripheral.wrap("top")
to peripheral.wrap("<wherever you monitor actually is>")
Beechey12 #3
Posted 17 August 2013 - 03:07 PM
I've got the monitor on the top the same as direwolf20 had it so that all i need to do is change the button names.
Everything works fine until i change the button name.
e.g. button.setTable("Test1", test1, 10,20,3,5) to button.setTable("Mybutton", test1, 10,20,3,5)
Lord_Spelunky #4
Posted 17 August 2013 - 05:37 PM
post exact code please :P/> I am not sure, maybe you are typing it wrong
Beechey12 #5
Posted 17 August 2013 - 06:20 PM
It's all copied from pastebin the only thing im trying to change is the name of the button the pastebin codes are in my first post.
It shows the name correctly but gives me the error if i click it.
Lord_Spelunky #6
Posted 17 August 2013 - 07:15 PM
I mean with the changed stuff :P/> So I can see whatever
Beechey12 #7
Posted 17 August 2013 - 07:56 PM
http://pastebin.com/KmTScEb0

There you go. The only difference is on line 6.I have tried using other names aswell but I always get the same error.
Kingdaro #8
Posted 17 August 2013 - 08:29 PM
My best guess is that when you click the button labeled "Button", it calls the test1() function, which then calls button.flash on "Test1", but there is no button named "Test1", as you renamed that to "Button" on line 6.
Beechey12 #9
Posted 17 August 2013 - 08:51 PM
Ahh yeah I see my mistake. Thankyou.

The stress is over :D/>