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

Issue with redstone.setBundledOutput

Started by trecneps, 14 April 2013 - 01:56 PM
trecneps #1
Posted 14 April 2013 - 03:56 PM

redstone.setBundledOutput("bottom", 0)
Whenever I call this line, I get the error message "attempt to index ? (a boolean value)"
But I use this exact same line at other places in the code.
Does anyone know what's wrong?
H4X0RZ #2
Posted 14 April 2013 - 03:58 PM
You can use "false" instead of "0"
Spongy141 #3
Posted 14 April 2013 - 04:02 PM
^
Yes you HAVE to use "false" instead of "0" since it is looking for either false or true, not 1 or 0. ALSO do

rs.setBundledOutput("bottom", false)
Instead of "redstone" it save space this way.
SadKingBilly #4
Posted 14 April 2013 - 04:19 PM
I'm sorry, but no. The second argument to rs.setBundledOutput() is an integer. The function clarifies a set of colors to turn on in the attached bundled cable. 0 means turn nothing on (or, turn everything off). There is nothing wrong with that line. I can't tell you what's wrong with your code if you don't show all your code.
Spongy141 #5
Posted 14 April 2013 - 04:25 PM
^
If the error says that that line is wrong, that line is wrong, so you don't need the rest of his code. Also (since I don't use redstone that much with computers) you still need to either say its true or false, theres no way around that.
SuicidalSTDz #6
Posted 14 April 2013 - 04:30 PM
Hmm, the last thing I would do is go to the wiki and read about their well-documented redstone functions
</sarcasm>

http://www.computerc...etBundledOutput

The first arg is the side, the second is an integer. Either a binary representation of the colour or ( colours.colourName )

Example time!

rs.setBundledOutput("top",colours.red) --top,red
rs.setBundledOutput("bottom",1) --bottom,white
Spongy141 #7
Posted 14 April 2013 - 05:10 PM
^
Lol I didn't know there was a thing called "rs.setBundledOutpot()"
</joke>
SuicidalSTDz #8
Posted 14 April 2013 - 05:18 PM
^
Lol I didn't know there was a thing called "rs.setBundledOutpot()"
</joke>
Heh, insanity is the only thing that keeps me sane..
Spongy141 #9
Posted 14 April 2013 - 06:55 PM
^
Makes no sense to me, but sounds extremely smart.
SadKingBilly #10
Posted 15 April 2013 - 01:36 AM
^
If the error says that that line is wrong, that line is wrong, so you don't need the rest of his code. Also (since I don't use redstone that much with computers) you still need to either say its true or false, theres no way around that.
Not necessarily. The error message often gets the line wrong. Besides, there is absolutely nothing wrong with the line he posted. He's not using rs.setOutput(), he's using rs.setBundledOutput(). Therefore, it doesn't work the same way and the second parameter is not a bool, it's an int. If you don't believe me, check the wiki. The only way that line could be throwing an error is if he doesn't have a bundled cable connected to the bottom of his computer.
H4X0RZ #11
Posted 15 April 2013 - 01:48 AM
theoriginalbit #12
Posted 15 April 2013 - 02:00 AM
Firstly
Not necessarily. The error message often gets the line wrong. Besides, there is absolutely nothing wrong with the line he posted. He's not using rs.setOutput(), he's using rs.setBundledOutput(). Therefore, it doesn't work the same way and the second parameter is not a bool, it's an int. If you don't believe me, check the wiki. The only way that line could be throwing an error is if he doesn't have a bundled cable connected to the bottom of his computer.
Error messages never get the line wrong. This isn't C++. Also the computer doesn't care whether or not there is a bundled cable attached, it just 'outputs' it in any case.

Secondly, rs.setBundledOutput must have a number as the second argument

-snip-
Thirdly, OP, we do need to see the rest of your code, the reason that it works in other places and not there is because at some point after using it you have overridden the redstone api table with a boolean, so then when you do redstone.setBundledOutput('bottom', 0) you are trying to index a boolean, i.e. you are trying to call the function 'setBundledOutput' on a boolean stored in a variable called 'redstone'.
SuicidalSTDz #13
Posted 15 April 2013 - 03:57 AM
Error messages never get the line wrong. This isn't C++. Also the computer doesn't care whether or not there is a bundled cable attached, it just 'outputs' it in any case.

Secondly, rs.setBundledOutput must have a number as the second argument

Thirdly, OP, we do need to see the rest of your code, the reason that it works in other places and not there is because at some point after using it you have overridden the redstone api table with a boolean, so then when you do redstone.setBundledOutput('bottom', 0) you are trying to index a boolean, i.e. you are trying to call the function 'setBundledOutput' on a boolean stored in a variable called 'redstone'.
Ah, music to my ears ^_^/>
SadKingBilly #14
Posted 15 April 2013 - 04:11 AM
Not necessarily. The error message often gets the line wrong. Besides, there is absolutely nothing wrong with the line he posted. He's not using rs.setOutput(), he's using rs.setBundledOutput(). Therefore, it doesn't work the same way and the second parameter is not a bool, it's an int. If you don't believe me, check the wiki. The only way that line could be throwing an error is if he doesn't have a bundled cable connected to the bottom of his computer.
Error messages never get the line wrong. This isn't C++.
I've seen error messages (in Lua (in ComputerCraft)) point to blank lines before.
theoriginalbit #15
Posted 15 April 2013 - 04:20 AM
I've seen error messages (in Lua (in ComputerCraft)) point to blank lines before.
That is because of these 2 reasons
  • The previous line is unfinished and it comes across an 'unexpected' symbol
  • There is an 'invisible' character there that has come across from copy/pasting from some websites, Skype, GitHub, Facebook, other forms of medium.
There are some error messages thrown by CC that don't supply line numbers, but they are ones that come from internal API's, so Java APIs not Lua APIs. And they display an error like "Invalid argument: String, string". But all other API and Lua errors supply the line number.