Difference between revisions of "Bit32.extract"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2022.3<br/> '''Class:''' bit32<br/> === Description === Returns the unsigned number formed by the bits field to field + width - 1...")
 
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Returns the unsigned number formed by the bits field to field + width - 1 from n.
 
Returns the unsigned number formed by the bits field to field + width - 1 from n.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(number) = bit32.extract(n,field,width)
 
(number) = bit32.extract(n,field,width)
</source>
+
</syntaxhighlight>
  
 
  '''Bits are numbered from 0 (least significant) to 31 (most significant). All accessed bits must be in the range [0, 31]. The default for width is 1'''
 
  '''Bits are numbered from 0 (least significant) to 31 (most significant). All accessed bits must be in the range [0, 31]. The default for width is 1'''

Latest revision as of 14:27, 13 July 2023

Available since: Gideros 2022.3
Class: bit32

Description

Returns the unsigned number formed by the bits field to field + width - 1 from n.

(number) = bit32.extract(n,field,width)
Bits are numbered from 0 (least significant) to 31 (most significant). All accessed bits must be in the range [0, 31]. The default for width is 1

Parameters

n: (number) value
field: (number) field value
width: (number) width value optional: default value 1

Return values

Returns (number) unsigned number

See also

Bitwise Operators