select: Difference between revisions

From Bohemia Interactive Community
m (VBS2 scripting category removal)
Line 60: Line 60:
[[Category:Command_Group:_Variables|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Variables|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

Revision as of 11:27, 2 November 2011

Hover & click on the images for description

Description

Description:
Selects an index element of an array or config object. Index 0 denotes the first element, 1 the second, etc.
If index has decimal places it gets rounded down for fractions less than .5, otherwise it gets rounded up.
Groups:
Uncategorised

Syntax

Syntax:
array select index
Parameters:
array : Array
index: Number
Return Value:
Any Value

Alternative Syntax

Syntax:
config select index
Parameters:
config: Config
index: Number
Return Value:
Config

Examples

Example 1:
[1,2,3,4] select 2 - result is 3
Example 2:
position player select 2 - result is Z coordinate of player position (see Position for more details)
Example 3:
(configFile >> "CfgVehicles") select 0

Additional Information

See also:
count

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note

Notes

When combined with the count command, this can be used to read all entries out of a config; even when you don't know exactly how many entries there will be. See the notes under count for more info. --General Barron 02:02, 3 March 2009 (CET)

Bottom Section