generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: how do i use xor in lua

Previous Thread :: Next Thread 
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
31 Oct 2015 07:57 PM
plsssss

OT in a nutshell: https://www.youtube.com/watch?v=KDRAhiBtOrQ
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
31 Oct 2015 07:57 PM
There is no built-in XOR operator or function in Lua 5.1 and below, however just use math and make a module.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
31 Oct 2015 08:17 PM
Why the hell would you even need xor?
Report Abuse
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
31 Oct 2015 08:20 PM
^
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
31 Oct 2015 08:26 PM
He's trying to show off something he'll never understand.
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
31 Oct 2015 08:57 PM
I need to emulate enums
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
31 Oct 2015 08:58 PM
'emulate enums'
'use xor'

You've confirmed your stupidity.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
31 Oct 2015 09:05 PM
I thought XOR stood for something like Executive Officer... Nvm, that's XO.
This must be Executive Orifice?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
31 Oct 2015 09:05 PM
Exclusive Or
Report Abuse
bigbadbob234 is not online. bigbadbob234
Joined: 26 Mar 2009
Total Posts: 64
31 Oct 2015 09:09 PM
You guys. It's a simple question.

Slightly hacky answer:

-- local fns are _slightly faster_ when used a lot
local function xor(a,b)
return (a or b and not (a and b))
end

-- Cookies and cream,
-- ~bigbadbob234
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
31 Oct 2015 09:30 PM
no
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
31 Oct 2015 10:06 PM
"a or b and not (a and b))"
how would that work
if either a or b was true, "a or b" would return true. a and b would return true if both were true. not true is false so that would return false.
Wait it would work
a = true
b = false
print(a and b)
--> false
not false = true
so yeah it would work
thanks

OT in a nutshell: https://www.youtube.com/watch?v=KDRAhiBtOrQ
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
31 Oct 2015 10:08 PM
cpmoderator you don't understand the logic behind what he's doing.
On the bit-level (for each bit), his would work, as crappy as it is (return a~=b is enough) but to actually implement xor, you can't use his way for obvious reasons.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image