Available:bitfield:extractFlagsAsArray() v1.165.0
The bitfield:extractFlagsAsArray()
function is available from v1.165.0
Decodes an integer to its bit-representation and extracts the
true
bits at specified indices
with specified names to an array. The array will contain the
names of the set bits, in order from lowest bit to highest bit.
The bits are indexed from 0 and will include up to 64 bits. If the value in the input field is larger, the lowest 64 bits will be used.
If the specified field does not exist, nothing happens. If an array with the name given as the output array already exists, it is overwritten.
Parameter | Type | Required | Default Value | Description |
---|---|---|---|---|
asArray | string | optional[a] | _flags[] | The name of the output array. Must follow valid Array Syntax. |
field | string | required | The name of the field to be decoded. | |
flagNames | array of arrays of strings | required | A list of pairs of indices in the bit-representation and the names of the flags that these correspond to. | |
[a] Optional parameters use their default value unless explicitly set. |
Validation:
In the
flagNames
parameter, the indices have to be non-negative numbers below 64.
The indices and the names of the flags have to be unique.
bitfield:extractFlagsAsArray()
Examples
Click
next to an example below to get the full details.Decode and Extract true
Bits as Arrays
Decode and extract true
bits as arrays using the bitfield:extractFlagsAsArray()
function