Arma 3 Scripting

selectMax

  • Arma 3 v1.66

Command · Markdown · JSON · original wiki page

Description

Returns the array element with maximum numerical value. Engine solution to BIS_fnc_greatestNum and BIS_fnc_findExtreme. Therefore it is expected that supplied array consists of Numbers only. Booleans however are also supported and will be evaluated as Numbers: true - 1, false - 0. nil value treated as 0.

Warning

Other non Number elements (not recommended) will be evaluated as 0 and Bad conversion: scalar message will be logged into .rpt.

Syntax

selectMax array

Parameters:

Returns: Number - element with maximum numerical value

Examples

Example 1

_max = selectMax [1,2,3,4,5]; //5

Example 2

// Same as, for example: 
_max = _a max _b max _c max _d;
// Only faster:
_max = selectMax [_a,_b,_c,_d];

See also

selectMin · min · max · selectRandom · select · selectRandomWeighted