flatten: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(examples)
m (Some wiki formatting)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command


| arma3dev |Game name=
|game1= arma3
|version1= 2.02


|2.01|Game version=
|gr1= Arrays


|gr1= Arrays |GROUP1=
|descr= Flattens an array.


| Flattens an array. |DESCRIPTION=
|s1= [[flatten]] array


| [[flatten]] array|SYNTAX=
|p1= array: [[Array]]


|p1= array: [[Array]] |PARAMETER1=
|r1= [[Array]] - flattened array


| [[Array]] - Flattened array|RETURNVALUE=
|x1= <sqf>flatten [1, [2], [[3]], [[[4]]]]; // returns [1, 2, 3, 4]</sqf>
 
|x1= <code>[[flatten]] [ 1, [2], <nowiki>[[3]]</nowiki>, [[[4]]] ];{{cc|Returns [1, 2, 3, 4]}}</code> |EXAMPLE1=


|x2= <code>[[flatten]] [[getUnitLoadout]] [[player]];</code> |EXAMPLE2=
|x2= <sqf>flatten getUnitLoadout player;</sqf>


| [[arrayIntersect]] |SEEALSO=
|seealso= [[arrayIntersect]]
}}
}}

Latest revision as of 13:45, 5 May 2022

Hover & click on the images for description

Description

Description:
Flattens an array.
Groups:
Arrays

Syntax

Syntax:
flatten array
Parameters:
array: Array
Return Value:
Array - flattened array

Examples

Example 1:
flatten [1, [2], [[3]], [[[4]]]]; // returns [1, 2, 3, 4]
Example 2:

Additional Information

See also:
arrayIntersect

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note