|
| 31 Oct 2015 07:57 PM |
plsssss
OT in a nutshell: https://www.youtube.com/watch?v=KDRAhiBtOrQ |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 31 Oct 2015 08:17 PM |
| Why the hell would you even need xor? |
|
|
| Report Abuse |
|
|
| |
|
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 |
|
|
| |
|
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 |
|
|
|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|