Bit32.replace

From GiderosMobile
Revision as of 14:26, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")

Available since: Gideros 2022.3
Class: bit32

Description

Returns a copy of a number with a range of bits replaced by a given value. <syntaxhighlight lang="lua"> (number) = bit32.replace(n,v,field,width) </source>

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

Parameters

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