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

Just need a little help

Started by Draminicus, 24 September 2015 - 05:55 AM
Draminicus #1
Posted 24 September 2015 - 07:55 AM
So i grabbed DireWolf20's reactor code as I have a very similar set up to his and I am garbage at coding.

But when I run the program I get the error code "reactor:304: attempt to index ? (a nil value)"



This is the paste bin

http://pastebin.com/A7v2sKyW <<Reactor

http://pastebin.com/XBbMUYNn <<Button


I know the problem lies on line 304 of the reactor script, but from what I'm seeing there is nothing wrong with it. any help would be apprecieated
valithor #2
Posted 24 September 2015 - 04:33 PM
It appears the peripheral.find call on line 3 failed to find a peripheral named "tile_blockcapacitorbank_name", or the peripheral it wrapped does not have the function called on line 304. I would assume that direwolf20s code is either made for a different version, you do not have openperipherals installed, or you do not have the peripheral attached as it is expecting it to be.

A few things you can do to help us figure out what is going on:

This can be run anywhere:

print(textutils.serialize(peripheral.getNames())) --Tell us what this prints

Put this code right after line 3 in your program:

if p then 
  for k,v in pairs(p) do
    print(k)
  end
end

Those two things will help us see if the name of the peripheral has changed between versions, and if it is even connected. The second one will list all of the methods that the peripheral has if it does exist.
Draminicus #3
Posted 25 September 2015 - 04:41 AM
Thank you so much for the help, after setting it from .find to .wrap and telling it the exact name of the cap bank it worked.