Skip to main content
Skip table of contents

25.2 Bit Library

Lua in T-Series devices is based on Lua 5.1.4 which did not include a bitwise library. A subset of Lua 5.2's Bitwise Library have been added. The name of the library is bin or bit instead of bit32. To use the AND function use instead of

Limitations on T-Series

The T4 and T7 use 32-bit floating point (single precision) numbers. To perform bitwise operations the 32-bit float is converted into an integer. The bitwise operation is performed. Then the integer is converted back into a floating point number. When converting to an integer some information can be lost. Any decimal places will be truncated off and only up to 23-bits will make it to the integer. This is because 8 bits is used for the exponent and 1 bit for sign.


Operation of the below functions match the Lua 5.2 bitwise library with the exception of the data type limitations. 

  • arshift
  • band
  • bnot
  • bor
  • bxor
  • lshift
  • rshift
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.