BIS fnc removeIndex: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ :\\\-\/|()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=function | {{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= Takes an array, and returns a new array with the specified index(es) removed. | |||
This takes the array passed in the first parameter, and returns an array that has the index number in the second parameter removed. | |||
If a third parameter is passed, then a range of indexes will be removed. | If a third parameter is passed, then a range of indexes will be removed. | ||
Alternatively, an array of indices to remove can be passed in the second parameter. | |||
{{Feature|arma3|Use [[deleteAt]] or [[deleteRange]] instead.}} | |||
{{Feature|arma3|Use [[deleteAt]] or [[deleteRange]] instead}} | |||
| [array,startIndex,endIndex] call [[BIS_fnc_removeIndex]] | |s1= [array, startIndex, endIndex] call [[BIS_fnc_removeIndex]] | ||
|p1=array: [[Array]] | |p1= array: [[Array]] | ||
|p2=startIndex: [[Number]] - | |p2= startIndex: [[Number]] - start index to be removed, if {{Link|#Parameter 3}} is not provided, only this index is removed | ||
|p3=endIndex: [[Number]] - (Optional, default [[Nothing]]) - | |p3= endIndex: [[Number]] - (Optional, default [[Nothing]]) - end index, if provided the indexs from startIndex to endIndex will be removed | ||
| [[Array]] - | |r1= [[Array]] - new array with new values | ||
|s2= [array, | |s2= [array, indices] call [[BIS_fnc_removeIndex]] | ||
|p21=array: [[Array]] | |p21= array: [[Array]] | ||
|p22= | |p22= indices: [[Array]] of [[Number]]s - indices to be removed | ||
|r2= [[Array]] - | |r2= [[Array]] - new array with new values | ||
|x1= < | |x1= <sqf> | ||
[array,0] | private _array = [0,1,2,3,4]; | ||
[array, 0] call BIS_fnc_removeIndex; // returns [1,2,3,4] | |||
</sqf> | |||
|x2= < | |x2= <sqf> | ||
[ | private _array = [0,1,2,3,4]; | ||
[_array, 0, 4] call BIS_fnc_removeIndex; // returns [] | |||
</sqf> | |||
|x3= < | |x3= <sqf> | ||
[ | private _array = [0,1,2,3,4]; | ||
[_array, [0,4]] call BIS_fnc_removeIndex; // returns [1,2,3] | |||
</sqf> | |||
|seealso= [[deleteAt]] | |seealso= [[deleteAt]] [[deleteRange]] | ||
}} | }} | ||
Latest revision as of 11:34, 1 July 2022
Description
- Description:
- Takes an array, and returns a new array with the specified index(es) removed. This takes the array passed in the first parameter, and returns an array that has the index number in the second parameter removed. If a third parameter is passed, then a range of indexes will be removed. Alternatively, an array of indices to remove can be passed in the second parameter.
- Execution:
- call
- Groups:
- Arrays
Syntax
- Syntax:
- [array, startIndex, endIndex] call BIS_fnc_removeIndex
- Parameters:
- array: Array
- startIndex: Number - start index to be removed, if Parameter 3 is not provided, only this index is removed
- endIndex: Number - (Optional, default Nothing) - end index, if provided the indexs from startIndex to endIndex will be removed
- Return Value:
- Array - new array with new values
Alternative Syntax
- Syntax:
- [array, indices] call BIS_fnc_removeIndex
- Parameters:
- array: Array
- indices: Array of Numbers - indices to be removed
- Return Value:
- Array - new array with new values
Examples
- Example 1:
- Example 2:
- Example 3:
Additional Information
- See also:
- deleteAt deleteRange
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