findIf

From Bohemia Interactive Community
Revision as of 16:31, 29 January 2021 by Lou Montana (talk | contribs) (Text replacement - "\{\{ *codecomment *\| *\/\/ *([^ ]+) *\}\} " to "{{cc|$1}}")
Jump to navigation Jump to search
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 unitwaitUntil { {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