This AI is still in early stages of development.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Current »

A global reference to the global object...

 

Syntax

global // the global object

Parameters

Not applicable.

Return value

The global 'global' property is a reference to the global object.

Example

Reference a property of the global object/scope
var bar = "kipper";
function foo() {
  var bar = "halibut";
  console(bar); // halibut
  console(global.bar); // kipper
}
Easily access global from within enclosures/sandboxes
(function(){ // https://warzone.atlassian.net/wiki/display/jsapi/Code+sandboxing
 
  var eventStartLevel; // oops, now we can't define global eventStartLevel from in here :(
 
  // oh, yes we can! :)
  global.eventStartLevel = function() {
    // code
  }
 
})();
Availability STABLE

This feature requires:

Contents

Jump to:

See also

Related articles:

  • object.addConst() – define a global constant (eg. from within a function)
  • Globals – global properties defined by Warzone JS API

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...

 

  • No labels