|Description:||Inserts the elements of one array into another, at a specified index. Neither arrays are touched by reference, a new array is returned.|
|Syntax:||[baseArray, insertArray, index] call fn_vbs_arrayInsert|
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.
_array = [[0,1,2,3,4], ["a","b","c"], 1] call fn_vbs_arrayInsert Returns: [0,"a","b","c",1,2,3,4]
|See also:||fn vbs arrayInsertOrdered, fn vbs arrayAdd, fn vbs setEach|
This command has a bug in versions before 1.22: the insertArray parameter will be modified by reference. So if you use a variable here, the variable will be changed after running the function. To prevent this, pass a copy of the array, using the + operator. Ex: [_baseArray, +_insertArray, _index] call fn_vbs_arrayInsert