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

[LUA] Colors API Color Constants broken?

Started by Megafont, 20 June 2012 - 01:34 AM
Megafont #1
Posted 20 June 2012 - 03:34 AM
What the heck? If I try to use one of the color constants, it always throws an


"attempt to index ? (a number value)".


I was trying to check if a certain output cable in a bundle was on like this:


bundleState = redstone.getBundledOutput("bottom")
if colors.test(bundleState, colors.white) == true then

but it throws that friggen error instead of doing what its supposed to do…
So I tried a test line like this:


print("RED: " .. colors.red)

These lines both throw that same error.
It seems to just absolutely hate the color constants…

I am pretty new to ComputerCraft. I am simply trying to make a little test program that shows me the state of all of the output channels in the redpower bundle that is connected to the computer. The program is pretty much complete except for this stupid problem that makes no sense!
Megafont #2
Posted 20 June 2012 - 04:09 AM
OK, how bizarre. I restarted my server and it magically works now!? wtf!?
Noodle #3
Posted 20 June 2012 - 10:08 AM
Sometime it glitches like that.
It also messes up and you can't craft computers, disk drives, etc.
Cloudy #4
Posted 20 June 2012 - 10:10 AM
Most likely someone overwrote the colors table - restarting the computer should have fixed it.

And if there is any problem with crafting stuff, that is not a computer craft issue - there is no way it could possibly remove its own recipes, so would have to be a plugin or another mod doing it.
Noodle #5
Posted 20 June 2012 - 10:12 AM
Nope, I was on vanilla and it did that. No plugins or anything. Just CC.
Cloudy #6
Posted 20 June 2012 - 10:14 AM
Well it's not possible - nothing in ComputerCraft can spontaneously remove its own recipes - end of story really.
Noodle #7
Posted 20 June 2012 - 10:16 AM
What if it did?
Cloudy #8
Posted 20 June 2012 - 02:35 PM
Then it's something else causing the issue - not ComputerCraft. I've seen the code. The only time it even TOUCHES the recipes, is when it is adding them. And that only happens once - the rest is handled by Minecraft and/or any mods which touch that part of the code.
kazagistar #9
Posted 20 June 2012 - 03:08 PM
It it is very likely that at some point, as you were writing your code, you did something like "colors=3". Afterwards, any time you called the API from anywhere, it would mess up, until you restarted.