Core Function InsertArray

From Sputnik Wiki
Revision as of 09:38, 26 August 2013 by UberFoX (Talk | contribs)
Jump to: navigation, search
InsertArray( <array>, <id>, <arrays> )

Contents

Description

Add arrays to an array at a given location

Parameters

array

The array to use.

id

Location to insert to.

Note - If location doesnt exist it will be created and the void between arrays end and your new index will be empty strings.

arrays

One or more arrays to add to the array.

Return Value

Success - Returns how many elements were done.

Failure - Returns false.

Remarks

Rather than adding the array as a value in a single index it will unravel the array and insert its values as if each value had been passed individually with insert().

Example

Example of just inserting one array

my $arr = array("One", "Five", "Six");
my $otherArr = array("Two", "Three", "Four");
 
insertArray($arr, 1, $otherArr);
 
printr($arr);

Exampkle of inserting more than one array at a time

my $arr = array("One", "Six");
my $otherArr = array("Two", "Three");
my $anotherArr = array("Four", "Five");
 
insertArray($arr, 1, $otherArr, $anotherArr);
 
printr($arr);
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox