Difference between revisions of "BIS fnc subSelect"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
(Page filling)
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
+
{{Function|Comments=
{{Function|= Comments
 
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
  
| arma2 |= Game name
+
| arma2 |Game name=
  
|1.00|= Game version
+
|1.00|Game version=
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
  
| <pre>
+
| Returns a sub-selection of the passed array. |Description=
/************************************************************
+
____________________________________________________________________________________________
Subarray Select
 
 
 
Returns a sub-selection of the passed array. There are various
 
methods the sub-array can be determined.
 
 
 
Parameters: [array, beg, <end>]
 
Returns: subarray
 
  
array - Array to select sub array from.
+
| [array, start, endOrLength] call [[BIS_fnc_subSelect]] |Syntax=
beg - Index of array to begin sub-array. If negative, index is
 
counted from the end of array.
 
end - Optional. 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).
 
  
Examples:
+
|p1= array: [[Array]] array to select sub array from |Parameter 1=
  
_array = ["a","b",true,3,8];
+
|p2= start: [[Number]] index of array to begin sub-array. '''If negative''', index is counted from the end of array |Parameter 2=
[_array, 2] call BIS_fnc_subSelect; //returns [true,3,8]
 
[_array, -2] call BIS_fnc_subSelect; //returns [3,8]
 
[_array, 1, 3] call BIS_fnc_subSelect; //returns ["b",true,3]
 
[_array, 1, -2] call BIS_fnc_subSelect; //returns ["b",true]
 
  
************************************************************/
+
|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) |Parameter 3=
  
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
+
| [[Array]] |Return value=
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
  
| <!-- [] call [[BIS_fnc_subSelect]]; --> |= Syntax
+
|x1= <code>_array = ["a","b",[[true]],3,8];
 +
[_array, 2] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns [true,3,8]}}</code> |Example 1=
  
|p1= |= Parameter 1
+
|x2= <code>[_array, -2] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns [3,8]}}</code> |Example 2=
  
| |= Return value
+
|x3= <code>[_array, 1, 3] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns ["b",true,3]}}</code> |Example 3=
____________________________________________________________________________________________
 
  
|x1= <code></code> |=  
+
|x4= <code>[_array, 1, -2] [[call]] [[BIS_fnc_subSelect]]; {{codecomment|// returns ["b",true]}}</code> |Example 4=
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
  
| |= See also
+
| [[select]], [[count]], [[selectRandom]], [[BIS_fnc_arrayShuffle]], [[BIS_fnc_randomIndex]] |See also=
 
 
 
}}
 
}}
  
Line 60: Line 42:
  
 
<h3 style="display:none">Bottom Section</h3>
 
<h3 style="display:none">Bottom Section</h3>
 +
[[Category:Functions|{{uc:subSelect}}]]
 
[[Category:Function Group: Arrays|{{uc:subSelect}}]]
 
[[Category:Function Group: Arrays|{{uc:subSelect}}]]
[[Category:Functions|{{uc:subSelect}}]]
 
 
[[Category:{{Name|arma2}}: Functions|{{uc:subSelect}}]]
 
[[Category:{{Name|arma2}}: Functions|{{uc:subSelect}}]]
 
[[Category:{{Name|arma2oa}}: Functions|{{uc:subSelect}}]]
 
[[Category:{{Name|arma2oa}}: Functions|{{uc:subSelect}}]]
 
[[Category:{{Name|tkoh}}: Functions|{{uc:subSelect}}]]
 
[[Category:{{Name|tkoh}}: Functions|{{uc:subSelect}}]]
 
[[Category:{{Name|arma3}}: Functions|{{uc:subSelect}}]]
 
[[Category:{{Name|arma3}}: Functions|{{uc:subSelect}}]]

Revision as of 14:21, 1 June 2018

Introduced with Arma 2 version 1.001.00
Hover & click on the images for descriptions

Description

Description:
Returns a sub-selection of the passed array.

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

Execution:
call
See also:
selectcountselectRandomBIS_fnc_arrayShuffleBIS_fnc_randomIndex
Groups:
Uncategorised

Notes

i
Only post proven facts here. Report bugs on the Feedback Tracker and discuss on the Arma Discord or on the Forums.

Notes

Bottom Section