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="Server" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
_G -- Table, contains all global variables.
_G -- returns a table of all global variables
_VERSION -- Version LUA in server.
_VERSION -- returns a string of the version of lua in the server in format "Lua 5.1"
coroutine -- Table, contains functions for thread.
coroutine -- returns a table containing functions for threads
debug -- Table, contains debug functions.
debug -- returns a table containing debug functions.
exports -- Table, contains all export functions server.
exports -- returns a table of resource names containing all export functions
math -- Table, contains mathematical functions.
math -- returns a table that contains mathematical functions.
resource -- Element, current resource.
resource -- returns a resource element of the resource the snippet was executed in
resourceRoot -- Element, root element current resource.
resourceRoot -- returns a resource root element of the resource the snippet was executed in
root -- Element, root element server.
root -- returns the root element of the server
string -- Table, contains string functions.
string -- returns a table containing functions for strings
table -- Table, contains functions for tables.
table -- returns a table that contains functions for tables
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
guiRoot -- Element, root element all GUI elements.
guiRoot -- returns the root element all GUI elements.
localPlayer -- Element, local player.
localPlayer -- returns the player element of the local player.
_G -- Table, contains all global variables.
_G -- returns a table that contains all global variables.
_VERSION -- Version LUA in client.
_VERSION -- returns a string of the version of lua in the client in format "Lua 5.1"
coroutine -- Table, contains functions for thread.
coroutine -- returns a table containing functions for threads
debug -- Table, contains debug functions.
debug -- returns a table containing debug functions.
exports -- Table, contains all export functions client.
exports -- returns a table of resource names containing all export functions
math -- Table, contains mathematical functions.
math -- returns a table that contains mathematical functions.
resource -- Element, current resource.
resource -- returns a resource element of the resource the snippet was executed in
resourceRoot -- Element, root element current resource.
resourceRoot -- returns a resource root element of the resource the snippet was executed in
root -- Element, root element client.
root -- returns the root element of the server
string -- Table, contains string functions.
string -- returns a table containing functions for strings
table -- Table, contains functions for tables.
table -- returns a table that contains functions for tables
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
List hidden local variables, that can be in functions-handlers:
The list of hidden variables, that can be found in functions and handlers:
<section name="Server/Client" class="both" show="true">
<section name="Server/Client" class="both" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
source -- Element, who call event.
source -- The player or element the event was attached to
this -- Element, which was attached function-handler.
this -- Element, which was attached function-handler.
sourceResource -- Resource, which was called event.
sourceResource -- the resource that called the event
sourceResourceRoot -- Element, root element resource, which was called event.
sourceResourceRoot -- the root of the resource that called the event
client -- Client, which was called event. If event called not client - not used.
client -- the client that called the event (server only)
eventName -- Name event, which called function-handler.
eventName -- the name of the event ("onResourceStart", "onPlayerWasted" etc.)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>


List create user [http://forum.mtasa.com/memberlist.php?mode=viewprofile&u=59875 Fro], [http://wiki.multitheftauto.com/wiki/AddEventHandler More details on the functios-handlers.]
[http://wiki.multitheftauto.com/wiki/AddEventHandler More details about hidden variables in functions and events]


[[Element_tree]]
[[Element_tree]]
If list is broken or change - write down update list and this post will be updated.
Original post by [http://forum.mtasa.com/memberlist.php?mode=viewprofile&u=45053 MX_Master]
[http://forum.mtasa.com/viewtopic.php?f=141&t=37420 link]

Revision as of 05:52, 11 February 2012

Click to collapse [-]
Server
_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
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 [-]
Client
guiRoot -- returns the root element all GUI elements.
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"
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

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