Predefined variables list: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<section name="Shared" class="both" show="true">
'''Lua Predefined variables'''
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
_G -- returns a table of all global variables
_G -- returns a table of all global variables
coroutine -- returns a table containing functions for threads
coroutine -- returns a table containing functions for threads
debug -- returns a table containing debug functions.
debug -- returns a table containing debug functions.
math -- returns a table that contains mathematical functions.
string -- returns a table containing functions for strings
table -- returns a table that contains functions for tables
_VERSION -- returns a string of the version of lua in format "Lua 5.1"
self -- used in methods.
</syntaxhighlight>
'''MTA Predefined variables'''
<section name="Shared" class="both" show="true">
<syntaxhighlight lang="lua">
exports -- returns a table of resource names containing all export functions
exports -- returns a table of resource names containing all export functions
math -- returns a table that contains mathematical functions.
resource -- returns a resource element of the resource the snippet was executed in
resource -- returns a resource element of the resource the snippet was executed in
resourceRoot -- returns a resource root element of the resource the snippet was executed in
resourceRoot -- returns a resource root element of the resource the snippet was executed in
root -- returns the root element of the server
root -- returns the root element of the server
string -- returns a table containing functions for strings
table -- returns a table that contains functions for tables
_VERSION -- returns a string of the version of lua in the client or server ( looking where to use ) in format "Lua 5.1"
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
<section name="Client only" class="client" show="true">
<section name="Client only" class="client" show="true">

Revision as of 09:22, 8 March 2012

Lua Predefined variables

_G -- returns a table of all global variables
coroutine -- returns a table containing functions for threads
debug -- returns a table containing debug functions.
math -- returns a table that contains mathematical functions.
string -- returns a table containing functions for strings
table -- returns a table that contains functions for tables
_VERSION -- returns a string of the version of lua in format "Lua 5.1"
self -- used in methods.

MTA Predefined variables

Click to collapse [-]
Shared
exports -- returns a table of resource names containing all export functions
resource -- returns a resource element of the resource the snippet was executed in
resourceRoot -- returns a resource root element of the resource the snippet was executed in
root -- returns the root element of the server
Click to collapse [-]
Client only
guiRoot -- returns the root element all GUI elements.
localPlayer -- returns the player element of the local player.

The list of hidden variables, that can be found in functions - handlers:

Click to collapse [-]
Shared
source -- The player or element the event was attached to
this -- Element, which was attached function-handler.
eventName -- the name of the event ("onResourceStart", "onPlayerWasted" etc.)
Click to collapse [-]
Server only
client -- the client that called the event 
sourceResourceRoot -- the root of the resource that called the event
sourceResource -- the resource that called the event


More details about hidden variables in functions and events

Element_tree

List Predefined variables available in the HTTP files:

[php]
requestHeaders -- table, contains all HTTP headlines current page.
form -- table, contains all POST and GET settings, transferred current page.
cookies -- table, contains all COOKIE, transferred current page.
hostname -- string, contains IP or name host, which requested current page.
url -- string, URL current page.
user -- element, account user, which requested current page.

More info about it