Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.




 

Introduced in

Version:1.19

Description

Description:Removes the first (leftmost) element of an array and returns it. The array is modified by reference.

Syntax

Syntax:array call fn_vbs_arrayShift
Parameters:
  • array: Array - Array to remove from.
    Note: Before V1.30, the array must be encased in brackets (in other words, the array must be in an array).
Return Value:Array - Element removed from left of the array.

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
_array = [1,2,3]; _num = _array call fn_vbs_arrayShift;
// Result: _array now holds [2,3], _num holds 1

Additional Information

See also: fn vbs arrayShiftStack (shifts multiple items), fn vbs arrayUnShift (reverse of shift), fn vbs arrayPop (removes items from the other end of the array)
Multiplayer: 
Problems:

Notes








Posted on August 28, 2008 - 18:22
raedor
Has a bug in versions before 1.22: The last element is removed also.