bit.bswap
Byte-swaps a 32-bit value.
Syntax
bit.bswap(a: any) -> nil
Parameters
| Parameter | Type | Description |
|---|---|---|
a | any | The a value used by the call. |
Returns
| Type | Description |
|---|---|
nil | This function does not return a value. |
Description
bit.bswap is part of the Bit operations library. The bit library performs 32-bit integer arithmetic with Luau bit32 semantics; inputs and results are normalized to 32 bits.
The operation is performed immediately using the arguments supplied at the call site.
Example
print(string.format("%08X", bit.bswap(0x12345678)))
Notes
- Values are normalized to 32-bit integers before and after each operation.