Core Function CallArray

From Sputnik Wiki
Revision as of 15:49, 20 January 2013 by UberFoX (Talk | contribs)
Jump to: navigation, search
CallArray <function/array>, <array>

Contents

Description

Calls a function contained in a string parameter

function

The name of the user function to call.

OR

A two element array to use as the call class and function name.

array

An array to send as the arguments to the function.

Return Value

Acts like a regular function call.

Remarks

The function CAN be a built-in Sputnik function or a user defined one.

This is similar to the Call() function but instead of sending arguments separated by , instead it sends a single array AS the arguments (The array will be resolved into individual arguments).

Example

CallArray("Test", array("One", "Two", "Three"));
 
Function Test()
{
	my $i = 0;
	foreach( @args as my $item )
	{
		println("ARG$i: $item");
		$i++;
	}
}

Example of using first param as an array

Class Testy
{
	Function __Construct()
	{
		CallArray(array($this, "Test"), array("One", "Two", "Three"));
	}
 
	Function Test()
	{
		my $i = 0;
		foreach( @args as my $item )
		{
			println("ARG$i: $item");
			$i++;
		}
	}
};
my $newTesty = new Testy();
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox