Jump to content

List of predefined variables.


Kenix

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: https://wiki.multitheftauto.com/wiki/Pre ... ables_list

Edited by Guest
  • Thanks 2
Link to comment
  • 4 weeks later...

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.

Link to comment
  • 3 weeks later...
  • 7 months later...
  • 1 month later...
  • 4 weeks later...
  • 1 month later...
  • 3 months later...
  • 2 weeks later...
  • 2 months later...

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)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...