bit.tobit Synchronous

Truncate a finite number and wrap it into the unsigned 32-bit range. Use it to normalize a value before fixed-width calculations.

Syntax
Luau
bit.tobit(value: number) -> number

Parameters

Function parameters
ParameterTypeDescription
valuenumberNumeric value to convert.

Returns

number

An unsigned 32-bit value stored as a Luau number.

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

Example
Luau
print(bit.tobit(4294967297)) -- 1
print(bit.tobit(3.9)) -- 3
Kawaii documentation