BIS fnc arrayShift: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category\:Function Group\: Arrays(\|\{\{[a-zA-Z0-9_:]+\}\})?\]\]" to "")
m (Text replacement - "_{10,} " to "")
Line 1: Line 1:
{{Function|Comments=
{{Function|Comments=
____________________________________________________________________________________________


| arma2 |Game name=
| arma2 |Game name=
Line 7: Line 6:


|gr1= Arrays|GROUP1=
|gr1= Arrays|GROUP1=
____________________________________________________________________________________________


| This function removes the first (leftmost) element of an array and returns it.<br>
| This function removes the first (leftmost) element of an array and returns it.<br>
Line 13: Line 11:
<br>
<br>
Similar to {{Inline code|array [[deleteAt]] 0}}. |DESCRIPTION=
Similar to {{Inline code|array [[deleteAt]] 0}}. |DESCRIPTION=
____________________________________________________________________________________________


| [array] call [[BIS_fnc_arrayShift]] |SYNTAX=
| [array] call [[BIS_fnc_arrayShift]] |SYNTAX=
Line 20: Line 17:


| [[Anything]] - the removed element |RETURNVALUE=
| [[Anything]] - the removed element |RETURNVALUE=
____________________________________________________________________________________________


|x1= <code>_myArray = ["2", "report", "status"];
|x1= <code>_myArray = ["2", "report", "status"];
Line 26: Line 22:
_removedElement == "2"; {{codecomment|// true}}
_removedElement == "2"; {{codecomment|// true}}
_myArray [[isEqualTo]] ["report", "status"]; {{codecomment|// true}}</code> |EXAMPLE1=
_myArray [[isEqualTo]] ["report", "status"]; {{codecomment|// true}}</code> |EXAMPLE1=
____________________________________________________________________________________________


| [[deleteAt]], [[pushBack]] |SEEALSO=
| [[deleteAt]], [[pushBack]] |SEEALSO=

Revision as of 22:41, 16 January 2021

Hover & click on the images for description

Description

Description:
This function removes the first (leftmost) element of an array and returns it.
The array is passed by reference so changes inside the function will be reflected outside of it.

Similar to array deleteAt 0.
Execution:
call
Groups:
Arrays

Syntax

Syntax:
[array] call BIS_fnc_arrayShift
Parameters:
array: Array - NOTE: given array must be within an array (e.g [[10, 20, 30]] call BIS_fnc_arrayShift)
Return Value:
Anything - the removed element

Examples

Example 1:
_myArray = ["2", "report", "status"]; _removedElement = [_myArray] call BIS_fnc_arrayShift; // array is within an array _removedElement == "2"; // true _myArray isEqualTo ["report", "status"]; // true

Additional Information

See also:
deleteAtpushBack

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