Magic Variables

From Bohemia Interactive Community
Revision as of 02:23, 29 April 2007 by Manny (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Stub

Introduction

Magic variables are variables that serve a specific purpose within a given scope and are often used by the engine to push data to a given script or code. They are usually no longer present after leaving the scope (e.g. after script execution, or after a forEach statement).

The most frequently used magic variable probably is _this, which is used to make execution arguments accessible to a script. Other uses of magic variables can be seen in forEach, where the current element can be accessed via _x. Triggers also define thislist, which is however only accessible within the activation or deactivation script in the editor.