Magic Variables: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 4: | Line 4: | ||
'''Magic variables''' are [[Variables|variables]] that serve a specific purpose within a given scope and are often used by the engine to push data to a given [[Script (File)|script]] or [[Code|code]]. They are usually no longer present after leaving the scope (e.g. after script execution, or after a [[forEach]] statement). | '''Magic variables''' are [[Variables|variables]] that serve a specific purpose within a given scope and are often used by the engine to push data to a given [[Script (File)|script]] or [[Code|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 <tt> | The most frequently used magic variable probably is <tt>_[[this]]</tt>, 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 <tt>_x</tt>. [[Triggers]] also define <tt>thislist</tt>, which is however only accessible within the activation or deactivation script in the editor. | Other uses of magic variables can be seen in [[forEach]], where the current element can be accessed via <tt>_x</tt>. [[Triggers]] also define <tt>thislist</tt>, which is however only accessible within the activation or deactivation script in the editor. |
Revision as of 11:03, 29 April 2007
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.