argument

This variable holds an array that is used along with the read-only variable argument_count in script functions or methods. Each array position holds an input value for the function and is specifically for use with variable argument functions.

Note that there are also a series of independent global scope variables that can also be used in user-defined functions to reference the different input arguments: argument0, argument1, argument2, etc... up to argument15, but these variables can only be used when the number of arguments supplied to the user-defined function are fixed and not variable.

NOTE: This isn't strictly required any more and is provided for legacy support more than anything else. All user-defined functions will accept variable arguments, and any argument passed into a function that is not part of the named inputs will be initialised to undefined by default, which can be checked using the is_undefined() function.

 

Syntax:

argument[n]
argument1
argument2
...
argument15

 

Returns:

Value (can be of any data type supplied to the function)

 

Example:

function my_array()
{
var i, arg;
for (i = 0; i < 5; i += 1;)
   {
   if argument_count > i
      {
      arg[i] = argument[i]
      }
   else
      {
      arg[i] = -1;
      }
   }
}

The above code uses the argument_count variable along with the argument array to initialize variables, and is an example of how to permit a user-defined function to accept a variable number of arguments.