BIS fnc removeIndex: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
(pf)
Line 1: Line 1:
 
{{Function|Comments=
{{Function|= Comments
____________________________________________________________________________________________
____________________________________________________________________________________________


| arma2 |= Game name
| arma2 |Game name=


|1.00|= Game version
|1.00|Game version=
____________________________________________________________________________________________
____________________________________________________________________________________________


| <pre>
|Takes an array, and returns a new array with the specified index(es)
/************************************************************
Remove Index
 
Parameters: [array, index, <end index>] OR [array, [indexes]]
 
Takes an array, and returns a new array with the specified index(es)
removed.
removed.


Line 24: 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}}|Description=
____________________________________________________________________________________________
| [array,startIndex,endIndex] call [[BIS_fnc_removeIndex]] |Syntax=
|p1=array: [[Array]] |Parameter 1=
|p2=startIndex: [[Number]] - Start index to be removed, if parameter 3 isn't provided, only this index is removed |Parameter 2=
|p3=endIndex: [[Number]] - (Optional, default [[Nothing]]) -  End index, if provided the indexs from startIndex to endIndex will be removed |Parameter 3=
| [[Array]] - New array with new values|Return value=
|s2= [array,indexes] call [[BIS_fnc_removeIndex]] |Alternative Syntax=


This function doesn't touch the original array (that is passed as a parameter).
|p21=array: [[Array]] |Parameter 21=


Examples:
|p22=indexes: [[Array]] of [[Number|numbers]] - Indexes to be removed |Parameter 22=


_array = [1,["b"],"c",[4],"d"];
|r2= [[Array]] - New array with new values |Alternative Return Value=


[_array, 2]      call BIS_fnc_removeIndex; //returns: [1,["b"],[4],"d"]
[_array, [0,1,3]] call BIS_fnc_removeIndex; //returns: ["c","d"]
[_array, 2, 3]    call BIS_fnc_removeIndex; //returns: [1,["b"],"d"]
************************************************************/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_removeIndex]]; --> |= Syntax
|x1= <code>_array = [0,1,2,3,4];
[array,0] [[call]] BIS_fnc_removeIndex;//Returns [1,2,3,4]</code>|Example 1=
 
|x2= <code>_array = [0,1,2,3,4];
[array,0,4] [[call]] BIS_fnc_removeIndex;//Returns []</code>|Example 2=
 
|x3= <code>_array = [0,1,2,3,4];
[array,[0,4]] [[call]] BIS_fnc_removeIndex;//Returns [1,2,3]</code>|Example 3=


|p1= |= Parameter 1


| |= Return value
____________________________________________________________________________________________


|x1= <code></code> |=
____________________________________________________________________________________________
____________________________________________________________________________________________


| |= See also
| [[deleteAt]], [[deleteRange]] |See also=
 
}}
}}



Revision as of 23:31, 27 June 2018

Hover & click on the images for description

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.
Arma 3
Use deleteAt or deleteRange instead
Execution:
call
Groups:
Uncategorised

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

Notes

Bottom Section