Jump to content




Does Lua Have A "xor" Function For Printing?


  • You cannot reply to this topic
10 replies to this topic

#1 GamerNebulae

  • Members
  • 216 posts
  • LocationNetherlands

Posted 12 August 2013 - 10: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?

#2 Lord_Spelunky

  • Members
  • 60 posts

Posted 12 August 2013 - 12: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.

#3 GamerNebulae

  • Members
  • 216 posts
  • LocationNetherlands

Posted 12 August 2013 - 12:48 PM

View PostLord_Spelunky, on 12 August 2013 - 12:45 PM, said:

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.

#4 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 12 August 2013 - 01: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


#5 GamerNebulae

  • Members
  • 216 posts
  • LocationNetherlands

Posted 12 August 2013 - 01:21 PM

View PostMysticT, on 12 August 2013 - 01:16 PM, said:

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.

#6 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 12 August 2013 - 01:24 PM

The bitwise xor? I just told you the bit api has one... And CraftOS has the bit api...

#7 GamerNebulae

  • Members
  • 216 posts
  • LocationNetherlands

Posted 12 August 2013 - 01:36 PM

View PostMysticT, on 12 August 2013 - 01:24 PM, said:

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.

#8 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 12 August 2013 - 01:42 PM

View PostGamerNebulae, on 12 August 2013 - 01:36 PM, said:

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.

#9 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 12 August 2013 - 01: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?

View PostGamerNebulae, on 12 August 2013 - 12:48 PM, said:

View PostLord_Spelunky, on 12 August 2013 - 12:45 PM, said:

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...

#10 Lord_Spelunky

  • Members
  • 60 posts

Posted 12 August 2013 - 01:55 PM

View Posttheoriginalbit, on 12 August 2013 - 01:53 PM, said:

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?

View PostGamerNebulae, on 12 August 2013 - 12:48 PM, said:

View PostLord_Spelunky, on 12 August 2013 - 12:45 PM, said:

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.

#11 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 12 August 2013 - 01:56 PM

View PostLord_Spelunky, on 12 August 2013 - 01:55 PM, said:

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...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users