a hash b: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Lou Montana (talk | contribs) m (Text replacement - "<dl class="command_description"> <dd class="notedate">" to "<dl class="command_description"> <dt></dt> <dd class="notedate">") |
||
Line 29: | Line 29: | ||
<!-- CONTINUE Notes --> | <!-- CONTINUE Notes --> | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<dt></dt> | |||
<dd class="notedate">Posted on April 25, 2018 - 00:51 (UTC)</dd> | <dd class="notedate">Posted on April 25, 2018 - 00:51 (UTC)</dd> | ||
<dt class="note">[[User:KC Grimes|KC Grimes]]</dt> | <dt class="note">[[User:KC Grimes|KC Grimes]]</dt> |
Revision as of 13:29, 5 April 2021
Description
- Description:
- Selects an element from an array, same as select command for arrays, but has higher precedence
- Groups:
- Variables
Syntax
Examples
- Example 1:
[1,2,3,4] # 2; // result is 3
- Example 2:
position player # 2; // result is Z coordinate of player's position
Additional Information
- See also:
- selectselectRandomselectRandomWeightedsetresizereverseinfindtoArraytoStringforEachcountdeleteAtdeleteRangeappendsortparamparamssplitStringjoinStringpushBackpushBackUniqueapply
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
- Posted on April 25, 2018 - 00:51 (UTC)
- KC Grimes
-
Although not alternative syntax, the below notations work as expected:
["A","B","C"] # 1; //B ["A","B","C"] #1; //B ["A","B","C"]#1; //B ["A","B",["C","D"]]#2#0; //C
- Posted on May 3, 2019 - 15:41 (UTC)
- 7erra
-
Here is an example of what higher precedence means:
[1,2,3,4] select 2/2; // divides 2 with 2, therefore selects second element = 2 [1,2,3,4] select (2/2); // same result with brackets [1,2,3,4] # 2/2; // selects third element, then divides by 2 = 1.5 ([1,2,3,4] # 2)/2; // same result with brackets
This operator can not be used in conjunction with the #define preprocessor.
#define SEL_ERR [0,1,2]#0 //error #define SEL_NOERR [0,1,2] select 0 //works
- Posted on April 2, 2021 - 16:18 (UTC)
- fett_li
- Beware new-lines when using this operator. I suspect the preprocessor to fail. The following code will not compile without throwing an error:
[0] # 0;