(info) This AI is still in early stages of development.

toArray()

Convert an array-like object in to an array...

 

Syntax

var actualArray = toArray(obj);

Parameters

ParameterTypeMandatoryDescriptionAPI Version
objVariant(tick)

An array-like object, for example the 'arguments' object within a function scope.

1.0

Return value

ValueTypeNotesAPI Version
<array>ArrayAn array containing the numeric keys and their values from the "obj" passed in to toArray()1.0
<error>ErrorAn error, most likely an invalid object was passed in to toArray().1.0

Example

function foo() {
	arguments = toArray(arguments);
	var lastArg = arguments.pop();
}
Availability STABLE

Requires:

Contents

Jump to:

Globals

Topics:

  • NativeAllows access to JS API natives that have been replaced or removed by the Define API...
  • toArray()Convert an array-like object in to an array...
  • nowReturn current universal time expressed as milliseconds since midnight, January 1, 1970.
  • out()Message output handler.
    • out.HOSTOutputs the message to the game host via in-game chat .
    • out.DEFAULTOutputs the message via out.HOST or out.CONSOLE depending on Warzone version.
    • out.ERROROutputs the message as an exception.
    • out.DEBUGOutput message to debug().
    • out.CONSOLEOutput message to console().
    • out.ASSERTAsserts whether config is truthy, and if not throws a game assert and a Javascript error...
    • out.CHATOutputs the message to allies of the script player via in-game chat.
    • out.RETURNReturns the message to the calling script.
  • difficultyScale()Select a value based on difficulty level...
  • globalA global reference to the global object...

See also

Related articles: