Bitwise operations (1001011101 etc)

Hey guys,

I’m looking for the way to read and write bits in a number. 

Something like

If NUMBER and 128 then do an action (check the variable NUMBER to see if the 128 bit is set. If true, then do something)

Set NUMBER 128 (Set the 128 bit to 1)

Clear NUMBER 128 (Set the 128 bit to 0)

Can anyone point me in the right direction for this?

Thanks.

Lua really doesn’t have much in the bitwise operators. But we do have a free plugin in the marketplace for this:

http://marketplace.coronalabs.com/plugin/bit

Rob

Lua really doesn’t have much in the bitwise operators. But we do have a free plugin in the marketplace for this:

http://marketplace.coronalabs.com/plugin/bit

Rob