select: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (alternate syntax)
No edit summary
Line 12: Line 12:
____________________________________________________________________________________________
____________________________________________________________________________________________


| array '''select''' index |= Syntax
| AnyArray <nowiki>=</nowiki>  '''select''' index |= Syntax


|p1= array: [[Array]] |= Parameter 1
|p1= AnyArray : [[Array]] |= Parameter 1


|p2= index: [[Number]] or [[Boolean]] |= Parameter 2
|p2= index: [[Number]] |= Parameter 2


| [[Any Value]] |= Return value
| [[Any Value]] |= Return value

Revision as of 01:57, 30 August 2007

Hover & click on the images for description

Description

Description:
Selects index element of the array. Index 0 denotes the first element, 1 the second, etc. If index has decimal places <= x.5 it gets floored, otherwise ceiled.
Groups:
Uncategorised

Syntax

Syntax:
AnyArray = select index
Parameters:
AnyArray : Array
index: Number
Return Value:
Any Value

Examples

Example 1:
[1,2,3,4] select 2 - result is 3
Example 2:
[1,2,3,4] select true - result is 2.
Alternative method. If the index is false, this selects the first element of the array. If it is true, it selects the second one. The reason for this is that false is an alias for 0 and true an alias for 1. Obsolete syntax.
Example 3:
position player select 2 - result is Z coordinate of player position (see Position for more details)

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