BIS_fnc_conditionalSelect

From Bohemia Interactive Community
Revision as of 19:42, 3 April 2006 by BIS fnc exportFunctionsToWiki (talk) (Generated by BIS_fnc_exportFunctionsToWiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Hover & click on the images for description

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