Available since: Gideros 2022.3
Class: bit32


Returns a copy of a number with a range of bits replaced by a given value.

(number) = bit32.replace(n,v,field,width)
Returns a copy of n with the bits field to field + width - 1 replaced by the value v. See bit32.extract() for details about field and width


n: (number) number value
v: (number) replace by value
field: (number) field value
width: (number) width value optional, default value 1

Return values

Returns (number) copy of n with range of bits replaced

See also

Bitwise Operators