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

Does Lua Have A "xor" Function For Printing?

Started by GamerNebulae, 12 August 2013 - 09:30 AM
GamerNebulae #1
Posted 12 August 2013 - 11:30 AM
Hello everyone!

I am working on my Nebulae API. It's a progress bar. Is there a xor function for printing stuff so the text blends in with the background?
Lord_Spelunky #2
Posted 12 August 2013 - 01:45 PM
You mean a loading bar? I believe someone has an API on it. I will try to find out who and show you.
GamerNebulae #3
Posted 12 August 2013 - 01:48 PM
You mean a loading bar? I believe someone has an API on it. I will try to find out who and show you.

Would be very nice.
MysticT #4
Posted 12 August 2013 - 02:16 PM
If you mean a bitwise xor, the bit api includes one (bit.bxor, IIRC). But I'm not sure how you plan to implement blending, since you can't combine colors.
If you need a logic xor (for if statements for example), lua doesn't have one. But, there's a few ways to get it. If you only use booleans, the easiest way is:

if bool1 == not bool2 then
end
GamerNebulae #5
Posted 12 August 2013 - 02:21 PM
If you mean a bitwise xor, the bit api includes one (bit.bxor, IIRC). But I'm not sure how you plan to implement blending, since you can't combine colors.
If you need a logic xor (for if statements for example), lua doesn't have one. But, there's a few ways to get it. If you only use booleans, the easiest way is:

if bool1 == not bool2 then
end

I don't need the logic xor. My dad used to program as well and he told me about the function, but I don't think CraftOS has that function.
MysticT #6
Posted 12 August 2013 - 02:24 PM
The bitwise xor? I just told you the bit api has one… And CraftOS has the bit api…
GamerNebulae #7
Posted 12 August 2013 - 02:36 PM
The bitwise xor? I just told you the bit api has one… And CraftOS has the bit api…

Sorry, I was a little vague there. I didn't mean the bitwise xor. I meant the xor function for printing stuff. That would make my life so much easier at the moment, but CraftOS doesn't have that. It makes the text the color of the background. You would need a rather difficult construction for that at the moment.
MysticT #8
Posted 12 August 2013 - 02:42 PM
Sorry, I was a little vague there. I didn't mean the bitwise xor. I meant the xor function for printing stuff. That would make my life so much easier at the moment, but CraftOS doesn't have that. It makes the text the color of the background. You would need a rather difficult construction for that at the moment.
I'm not sure what you mean. I never heard of something like "xor function for printing".
Now, if you want to set the text color to the same as the background, you don't need any xor, and or whatever. You only need to know the background color (easy if you are setting it), and set the text color to the same one.
theoriginalbit #9
Posted 12 August 2013 - 02:53 PM
You're going to have to explain more than "xor function for printing stuff"… This is a term that I've never heard of in all my years of programming, and haven't been taught at uni (suspecting because it doesn't exist)… Maybe your dad can explain it better?

You mean a loading bar? I believe someone has an API on it. I will try to find out who and show you.
Would be very nice.
I've got one… Look on my programs thread…
Lord_Spelunky #10
Posted 12 August 2013 - 02:55 PM
You're going to have to explain more than "xor function for printing stuff"… This is a term that I've never heard of in all my years of programming, and haven't been taught at uni (suspecting because it doesn't exist)… Maybe your dad can explain it better?

You mean a loading bar? I believe someone has an API on it. I will try to find out who and show you.
Would be very nice.
I've got one… Look on my programs thread…

Damn I looked on your website instead, thats it, yuppppp.
theoriginalbit #11
Posted 12 August 2013 - 02:56 PM
Damn I looked on your website instead, thats it, yuppppp.
Yeh my webhost must have up and died or something, because my webspace has just gone and disappeared…