No bitwise not? Only AND, OR, Shift left and Shift right?

Is there anyway I can do a bitwise NOT in GLua?

I need to be able to easily add and remove flags in a variable and I’m not sure how to easily remove it without the NOT.

Any help is awesome, thanks!

Thats a Yes, There is no NOT

I know that already, that is why I am asking if anyone has another way to do it.

Not sure about this.

[lua]function bnot(a,b)
return (a&b==0)
end[/lua]

I’ve never used bitwise not, so I’m not sure if that’s the proper functionality.

Nope, a bitwise not would turn, say, an 8bit number 01000101 into 10111010

How would you “not 01000101” if you don’t know the length?
That could as well be 00000 … 00000000001000101, right?
Only way you can not is do something like return 11111111-01000101

[lua]
function bnot(a)
return 0xffffffff-a
end
[/lua]

[editline]meh[/editline]

Or to just remove a flag
[lua]
FLAGS = FLAGS-(FLAGS & flag)
[/lua]

Normally it is taken care of by your processor directly on a memory value. I have seen code back in the day that converts a number into binary and does it manually but it is excessively slow in comparison but I don’t need it to be fast. I just wanted an easy solution if it was known.