BIS_fnc_conditionalSelect
Jump to navigation
Jump to search
Description
- Description:
/************************************************************ Conditional Select Parameters: [array, {condition}] This returns a sub-array of elements that satisfy a specific condition. The originally passed array is NOT modified! The function takes, in order, every element of the passed array, evaluates it in the condition, and, if the condition is true, adds it to the return array. In the condition, the currently tested element is assigned to the variable "_x". Care must be taken that the condition won't cause errors. For example, if your condition assumes all elements are numbers, errors will occur if your array includes strings. This function is similar to the "count" command, only it returns the elements of the array that satisfy the condition, rather than simply returning the count. Example: [[10,0,8,2,6,4], {_x > 5}] call BIS_fnc_conditionalSelect Returns: [10,8,6] Example: [[10,true,8,player], {typename _x == "STRING"}] call BIS_fnc_conditionalSelect Returns: [] ************************************************************/
(Placeholder description extracted from the function header by BIS_fnc_exportFunctionsToWiki)- Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- Syntax needed
- Return Value:
- Return value needed
Examples
- Example 1:
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
Notes
Bottom Section
- Posted on May 8, 2016 - 07:26 (UTC)
- AgentRevolution
- Since Arma 3 v1.55, the select command can be used to make conditional selections just like this function.