moonscript
moonscript copied to clipboard
XOR not correclty supported
Hello, I noticed that the xor operator even though it exists in LUA is not usable in moonscript:
The following code:
c = a ~ b
in moonscript
gives the following output:
local c = a(~b)
in lua.
The ~
should behave the same way as the -
since both symbol are used in monadic form and dyadic form.
XOR is not supported at all.
I just came across this issue. I'm not sure why it wasn't implemented like subtraction/negation but this is my work-around.
xor = (a, b) -> (a | b) - (a & b)