Difference between revisions of "Bit32.replace"
From GiderosMobile
|  (Created page with "__NOTOC__ '''Available since:''' Gideros 2022.3<br/> '''Class:''' bit32<br/>  === Description === Returns a copy of a number with a range of bits replaced by a given value...") | m (Text replacement - "</source>" to "</syntaxhighlight>") | ||
| (One intermediate revision by the same user not shown) | |||
| Line 5: | Line 5: | ||
| === Description === | === Description === | ||
| Returns a copy of a number with a range of bits replaced by a given value. | 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) | (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
