findIf: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<h3 style="display:none">Bottom Section</h3> " to "")
m (Text replacement - "{{Command " to "{{RV|type=command ")
Line 1: Line 1:
{{Command
{{RV|type=command


| arma3
| arma3

Revision as of 00:12, 23 January 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Arrays

Syntax

Syntax:
Syntax needed
Parameters:
array: Array - array to search in
code: Code - code defining an element to find, processed element can be referenced within the code as _x
Return Value:
Return value needed

Examples

Example 1:
[unit1, unit2, unit3] findIf {not alive _x}; // return index of the first dead unit)
Example 2:
// two ways how to 'wait for all units to be dead': waitUntil { [unit1, unit2, unit3] findIf {alive _x} == -1 }; // fast, terminates as soon as it finds a living unit waitUntil { {alive _x} count [unit1, unit2, unit3] == 0 }; // slow, always goes through all array elements

Additional Information

See also:
See also needed

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