BIS fnc removeIndex: 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 | ||
|Takes an array, and returns a new array with the specified index(es) | |Takes an array, and returns a new array with the specified index(es) | ||
Line 17: | Line 17: | ||
Alternatively, you can pass an array of indexes to remove in the | Alternatively, you can pass an array of indexes to remove in the | ||
second parameter. | second parameter. | ||
{{Feature|arma3|Use [[deleteAt]] or [[deleteRange]] instead}} | {{Feature|arma3|Use [[deleteAt]] or [[deleteRange]] instead}} | ||
| [array,startIndex,endIndex] call [[BIS_fnc_removeIndex]] | | [array,startIndex,endIndex] call [[BIS_fnc_removeIndex]] | ||
|p1=array: [[Array]] | |p1=array: [[Array]] | ||
|p2=startIndex: [[Number]] - Start index to be removed, if parameter 3 isn't provided, only this index is removed | |p2=startIndex: [[Number]] - Start index to be removed, if parameter 3 isn't provided, only this index is removed | ||
|p3=endIndex: [[Number]] - (Optional, default [[Nothing]]) - End index, if provided the indexs from startIndex to endIndex will be removed | |p3=endIndex: [[Number]] - (Optional, default [[Nothing]]) - End index, if provided the indexs from startIndex to endIndex will be removed | ||
| [[Array]] - New array with new values | | [[Array]] - New array with new values | ||
|s2= [array,indexes] call [[BIS_fnc_removeIndex]] | |s2= [array,indexes] call [[BIS_fnc_removeIndex]] | ||
|p21=array: [[Array]] |Parameter 21= | |p21=array: [[Array]] |Parameter 21= | ||
Line 40: | Line 40: | ||
|x1= <code>_array = [0,1,2,3,4]; | |x1= <code>_array = [0,1,2,3,4]; | ||
[array,0] [[call]] BIS_fnc_removeIndex;//Returns [1,2,3,4]</code> | [array,0] [[call]] BIS_fnc_removeIndex;//Returns [1,2,3,4]</code> | ||
|x2= <code>_array = [0,1,2,3,4]; | |x2= <code>_array = [0,1,2,3,4]; | ||
[array,0,4] [[call]] BIS_fnc_removeIndex;//Returns []</code> | [array,0,4] [[call]] BIS_fnc_removeIndex;//Returns []</code> | ||
|x3= <code>_array = [0,1,2,3,4]; | |x3= <code>_array = [0,1,2,3,4]; | ||
[array,[0,4]] [[call]] BIS_fnc_removeIndex;//Returns [1,2,3]</code> | [array,[0,4]] [[call]] BIS_fnc_removeIndex;//Returns [1,2,3]</code> | ||
| [[deleteAt]], [[deleteRange]] | | [[deleteAt]], [[deleteRange]] | ||
}} | }} | ||
Revision as of 23:40, 17 January 2021
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, you can pass an array of indexes to remove 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 isn't 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,indexes] call BIS_fnc_removeIndex
- Parameters:
- array: Array
- indexes: Array of numbers - Indexes to be removed
- Return Value:
- Array - New array with new values
Examples
- Example 1:
_array = [0,1,2,3,4]; [array,0] call BIS_fnc_removeIndex;//Returns [1,2,3,4]
- Example 2:
_array = [0,1,2,3,4]; [array,0,4] call BIS_fnc_removeIndex;//Returns []
- Example 3:
_array = [0,1,2,3,4]; [array,[0,4]] call BIS_fnc_removeIndex;//Returns [1,2,3]
Additional Information
- See also:
- deleteAtdeleteRange
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