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="Server" class="server" show="true">
<section name="Shared" class="both" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
_G -- returns a table of all global variables
_G -- returns a table of all global variables
_VERSION -- returns a string of the version of lua in the server in format "Lua 5.1"
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.
Line 12: Line 11:
string -- returns a table containing functions for strings
string -- returns a table containing functions for strings
table -- returns a table that contains functions for tables
table -- returns a table that contains functions for tables
</syntaxhighlight>
</section>
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
_VERSION -- returns a string of the version of lua in the server in format "Lua 5.1"
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
Line 18: Line 22:
guiRoot -- returns the root element all GUI elements.
guiRoot -- returns the root element all GUI elements.
localPlayer -- returns the player element of the local player.
localPlayer -- returns the player element of the local player.
_G -- returns a table that contains all global variables.
_VERSION -- returns a string of the version of lua in the client in format "Lua 5.1"
_VERSION -- returns a string of the version of lua in the client in format "Lua 5.1"
coroutine -- returns a table containing functions for threads
debug -- returns a table containing debug 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
resourceRoot -- returns a resource root element of the resource the snippet was executed in
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
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 05:54, 11 February 2012

Click to collapse [-]
Shared
_G -- returns a table of all global variables
coroutine -- returns a table containing functions for threads
debug -- returns a table containing debug 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
resourceRoot -- returns a resource root element of the resource the snippet was executed in
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
Click to collapse [-]
Server
_VERSION -- returns a string of the version of lua in the server in format "Lua 5.1"
Click to collapse [-]
Client
guiRoot -- returns the root element all GUI elements.
localPlayer -- returns the player element of the local player.
_VERSION -- returns a string of the version of lua in the client in format "Lua 5.1"

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

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

More details about hidden variables in functions and events

Element_tree