Kenix

List of predefined variables.

Recommended Posts

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.


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 all elements 
  


Client only


guiRoot -- returns the root element all GUI elements. 
localPlayer -- returns the player element of the local player. 


List hidden local variables, that can be in functions-handlers:

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.) 


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 


List create user Fro, More details on the functios-handlers

Element tree

If list is broken or change - write down update list and this post will be updated.

Original post by MX_Master

viewtopic.php?f=141&t=37420

Wiki: http://wiki.multitheftauto.com/wiki/Pre ... ables_list

Edited by Guest

Share this post


Link to post

I think the name should be "predefined variables", not "global variables".

But this is a very nice info.

  • Like 1

Share this post


Link to post

Updated.

Edited by Guest

Share this post


Link to post

1. imo, it's better to have just the 2 lists: server/client. this 4-part-shared idea is overcomplicated.

2. what about "self" in methods?

also, i believe there should be some indication, which vars belong to Lua and which introduced by MTA.

Share this post


Link to post

Updated.

1. imo, it's better to have just the 2 lists: server/client. this 4-part-shared idea is overcomplicated.

I think better don't change.

Edited by Guest

Share this post


Link to post

Amazing write up!! List of predefined variables are flabbergast..Would like to thanks for imparting this with us.

Share this post


Link to post
This is an old topic -.-"

and ?

Share this post


Link to post

Alot of people dont know the types of variables. Maybe you could add some of them? Alsoa dd the tostring etc, people dont know what it does, if you're able to use it etc? (People without any programmings knowledge or web dev's in html/php dont know the tostring, tonumber, int, string, double, float etc)

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.