flatten: Difference between revisions

From Bohemia Interactive Community
m (Some wiki formatting)
mNo edit summary
 
(2 intermediate revisions by one other user not shown)
Line 10: Line 10:
|s1= [[flatten]] array
|s1= [[flatten]] array


|p1= array: [[Array]]
|p1= array: [[Array]] of [[Anything]]


|r1= [[Array]] - flattened array
|r1= [[Array]] of [[Anything]] - flattened array
 
|x1= <code>[[flatten]] [1, [2], <nowiki>[[3]]</nowiki>, [[[4]]]]; {{cc|returns [1, 2, 3, 4]}}</code>


|x2= <code>[[flatten]] [[getUnitLoadout]] [[player]];</code>
|x1= <sqf>flatten [1, [2], [[3]], [[[4]]]]; // returns [1, 2, 3, 4]</sqf>
 
|x2= <sqf>flatten getUnitLoadout player;</sqf>


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

Latest revision as of 11:41, 1 January 2026

Hover & click on the images for description

Description

Description:
Flattens an array.
Groups:
Arrays

Syntax

Syntax:
flatten array
Parameters:
array: Array of Anything
Return Value:
Array of Anything - 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.
Only post proven facts here! Add Note