BIS fnc subSelect: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "|Game version=" to "|Game version= |gr1= Arrays |GROUP1") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(30 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=function | ||
| arma2 | | |game1= arma2 | ||
|version1= 1.00 | |||
|1. | |game2= arma2oa | ||
|version2= 1.50 | |||
| | |game3= tkoh | ||
|version3= 1.00 | |||
| | |game4= arma3 | ||
|version4= 0.50 | |||
| | |gr1= Arrays | ||
| | |descr= Returns a sub-selection of the passed array. | ||
| | |s1= [array, start, endOrLength] call [[BIS_fnc_subSelect]] | ||
| | |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 | ||
| | |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) | ||
| | |r1= [[Array]] | ||
| | |x1= <sqf> | ||
private _array = ["a", "b", true, 3, 8]; | |||
[_array, 2] call BIS_fnc_subSelect; // returns [true,3,8] | |||
</sqf> | |||
| | |x2= <sqf>[_array, -2] call BIS_fnc_subSelect; // returns [3,8]</sqf> | ||
| [ | |x3= <sqf>[_array, 1, 3] call BIS_fnc_subSelect; // returns ["b",true,3]</sqf> | ||
< | |x4= <sqf>[_array, 1, -2] call BIS_fnc_subSelect; // returns ["b",true]</sqf> | ||
< | |||
|seealso= [[select]] [[count]] [[selectRandom]] [[BIS_fnc_arrayShuffle]] [[BIS_fnc_randomIndex]] | |||
}} | |||
[[ | |||
[[ | |||
[[ | |||
[[ | |||
[[ | |||
Latest revision as of 23:02, 12 July 2022
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:
- Example 2:
- Example 3:
- Example 4:
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