bit. tohex Synchronous
Show the unsigned 32-bit representation of a number as lowercase hexadecimal. It is convenient when inspecting flags, packet fields, or the result of a byte swap.
Luau
bit.tohex(value: number, ...ignored: any) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
value | number | Finite number to normalize to 32 bits. |
...ignored | any | Additional arguments are ignored. A width or padding option is not implemented. |
Returns
stringLowercase hexadecimal text without leading zero padding.
Usage notes
This always describes the unsigned 32-bit value, even when the input number was negative.
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(255)) -- ff
print(bit.tohex(-1)) -- ffffffff