Difference between revisions of "Bit32.replace"
From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight") |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
Line 7: | Line 7: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
(number) = bit32.replace(n,v,field,width) | (number) = bit32.replace(n,v,field,width) | ||
− | </ | + | </syntaxhighlight> |
'''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''' | '''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''' |
Latest revision as of 14:26, 13 July 2023
Available since: Gideros 2022.3
Class: bit32
Description
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
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