bit. bswap Synchronous
Reverse the order of the four bytes in a 32-bit value. Use it to convert between little-endian and big-endian representations.
Luau
bit.bswap(value: number) -> numberParameters
| Parameter | Type | Description |
|---|---|---|
value | number | Number whose four bytes should be reversed. |
Returns
numberThe value with its byte order reversed.
Differences from Volt
Volt documents its Bit Library setting as disabled by default. Kawaii enables bit by default. Disabling the setting removes the bit global and makes retained function references reject calls.
Availability
Bit is enabled by default. The bit global is removed when disabled, and its operations check the setting.
Example
Luau
print(bit.tohex(bit.bswap(0x12345678))) -- 78563412