moonscript icon indicating copy to clipboard operation
moonscript copied to clipboard

XOR not correclty supported

Open hashalon opened this issue 7 years ago • 2 comments

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.

hashalon avatar Mar 10 '17 05:03 hashalon

XOR is not supported at all.

buckle2000 avatar Mar 10 '17 05:03 buckle2000

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)

nathanjent avatar Jan 16 '23 19:01 nathanjent