BIS fnc subSelect: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl> " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
| arma2 | | arma2 | ||
|1.00 | |1.00 | ||
|gr1= Arrays | |gr1= Arrays | ||
| Returns a sub-selection of the passed array. | | Returns a sub-selection of the passed array. | ||
| [array, start, endOrLength] call [[BIS_fnc_subSelect]] | | [array, start, endOrLength] call [[BIS_fnc_subSelect]] | ||
|p1= array: [[Array]] array to select sub array from | |p1= array: [[Array]] array to select sub array from | ||
|p2= start: [[Number]] index of array to begin sub-array. '''If negative''', index is counted from the end of array | |p2= start: [[Number]] index of array to begin sub-array. '''If negative''', index is counted from the end of array | ||
|p3= endOrLength: [[Number]] - index of array to end the sub-array. If ommitted, remainder of the array will be selected. '''If negative''', it specifies the length of the sub-array (in absolute form) | |p3= endOrLength: [[Number]] - index of array to end the sub-array. If ommitted, remainder of the array will be selected. '''If negative''', it specifies the length of the sub-array (in absolute form) | ||
| [[Array]] | | [[Array]] | ||
|x1= <code>_array = ["a","b",[[true]],3,8]; | |x1= <code>_array = ["a","b",[[true]],3,8]; | ||
[_array, 2] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns [true,3,8]}}</code> | [_array, 2] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns [true,3,8]}}</code> | ||
|x2= <code>[_array, -2] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns [3,8]}}</code> | |x2= <code>[_array, -2] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns [3,8]}}</code> | ||
|x3= <code>[_array, 1, 3] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns ["b",true,3]}}</code> | |x3= <code>[_array, 1, 3] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns ["b",true,3]}}</code> | ||
|x4= <code>[_array, 1, -2] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns ["b",true]}}</code> | |x4= <code>[_array, 1, -2] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns ["b",true]}}</code> | ||
| [[select]], [[count]], [[selectRandom]], [[BIS_fnc_arrayShuffle]], [[BIS_fnc_randomIndex]] | | [[select]], [[count]], [[selectRandom]], [[BIS_fnc_arrayShuffle]], [[BIS_fnc_randomIndex]] | ||
}} | }} | ||
Revision as of 23:44, 17 January 2021
Description
Syntax
- Syntax:
- [array, start, endOrLength] call BIS_fnc_subSelect
- Parameters:
- array: Array array to select sub array from
- start: Number index of array to begin sub-array. If negative, index is counted from the end of array
- endOrLength: Number - index of array to end the sub-array. If ommitted, remainder of the array will be selected. If negative, it specifies the length of the sub-array (in absolute form)
- Return Value:
- Array
Examples
- Example 1:
_array = ["a","b",true,3,8]; [_array, 2] call BIS_fnc_subSelect; // returns [true,3,8]
- Example 2:
[_array, -2] call BIS_fnc_subSelect; // returns [3,8]
- Example 3:
[_array, 1, 3] call BIS_fnc_subSelect; // returns ["b",true,3]
- Example 4:
[_array, 1, -2] call BIS_fnc_subSelect; // returns ["b",true]
Additional Information
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