A question I was wondering about.
(A forewarning: LUA does not exist. The language is called "Lua". It is not an acronym; it means "Moon" in Portuguese.)
I'm not exactly sure what you mean by "terms", but ROBLOX uses Lua 5.1, with some modifications.
First, the exact flavor of Lua used by ROBLOX is known as "RBX.Lua".
The os
library, except for os.time()
, has been completely removed. loadstring()
and require()
are heavily altered. loadstring()
only works server-side unless you enabled a property of Workspace, and AFAIK does not load bytecodes (which is a common way to obfuscate Lua code.). require()
in RBX.Lua is used to load ModuleScripts, and this functionality is a ROBLOX-specific implementation. Finally, the _G
table cannot be implicitly accessed. That is:
_G.THINGY = "String Here!" print(THINGY) --> Prints `nil` print(_G.THINGY) --> `String Here!`
RBX.Lua has four unique global variables: script
, game
, workspace
, and shared
.
script
is a reference to the Script, ModuleScript, or LocalScript object running the current Lua code.
game
is a reference to the DataModel itself. It is the Parent of the Services you see in the Explorer menu, and can be considered to be represented by the Explorer menu itself.
workspace
is a shortcut for game.Workspace
, as it is used very often in RBX.Lua
shared
is, effectively, a second _G
.
workspace
and game
each have an alias: Workspace
and Game
. The lowercase versions are more "standard", but both work fine.
Traversing the DataModel (from one of the two reference globals) is done as if traversing Tables. The dot access and bracket access operators work as expected. The Parent
property is used to go 'up' a level in the DataModel. Accessing ROBLOX Object properties is done the same way.
There is one caveat to this: trying to access a ROBLOX Object that doesn't exist will throw an error. To get around this, we have the FindFirstChild
method of all ROBLOX Objects (known as Instances)
Objects with the same names as properties have to be accessed using FindFirstChild
, as the bracket access and dot access operators will return the property instead.
ROBLOX has many custom data types, which you can read more about from this page.
This was all pulled from memory, so there may be more than this different. Please feel free to ask any questions you may have about RBX.Lua or Lua 5.1 in general!
To quote Roblox "Roblox uses Lua 5.1", this means that it will have all of the functionality as lua except including any changes or additions Roblox have made.
Locked by TheMyrco
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?