bit.rshift Synchronous

Move bits right and fill the high positions with zeroes. Combine it with a mask to read a field from a packed integer.

Syntax
Luau
bit.rshift(value: number, count: number) -> number

Parameters

Function parameters
ParameterTypeDescription
valuenumberFinite number to truncate and interpret as an unsigned 32-bit value.
countnumberShift or rotation count, normalized to 32 bits and masked with 31. Counts 32 and 0 therefore perform the same operation.

Returns

number

The resulting unsigned 32-bit value.

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
local packed = 0x1234
print(bit.tohex(bit.band(bit.rshift(packed, 8), 0xff))) -- 12
Kawaii documentation