Lua

On Roblox, Lua (commonly RBX.lua) refers to the engine's implementation of the Lua programming language. Lua is primarily used in scripts that change the behavior of the server and the client, and is also used in other programs such as plugins which extend the functionality of Roblox Studio. With focus on game development, Roblox modified its implementation of Lua, introducing new data types and removal/changes of standard Lua libraries. Roblox uses its own dialect of Lua, known as Luau, which is derived from Lua 5.1.4 with many changes including performance optimizations and gradual typing.
== History ==
Roblox previously supported execution of Lua bytecode through the standard Lua library function loadstring. On August 3, 2012, Roblox stopped supporting this method of execution for security and version compatibility reasons.
On August 27, 2019, Roblox would switch its scripting language from Lua 5.1.4 to Luau.
== Implementation ==
To be suitable for game development on Roblox, Roblox's implementation of Lua has had some changes, primarily dealing with the standard Lua libraries.
Many functions as well as some libraries were excluded (accessing them will result in nil):
* io and package libraries were excluded.
* Most debug and os library functions were excluded, specifically:
** All other functions in the debug library (except for debug.traceback)
** debug.getinfo (Roblox uses a similar function debug.info)
** os.execute
** os.exit
** os.getenv
** os.remove
** os.rename
** os.setlocale
** os.tmpname
Roblox also introduced its own data types to the implementation, including instances.
== Execution ==
There are many ways Lua code can be run in the Roblox's engine:
*Scripts, which are executed automatically based on their conditions.
*Using the command bar in Roblox Studio or in the Developer Console.
*A file selected through the Run Script button in Roblox Studio.
== Trivia ==
* There is an asset type (ID 5) for assets containing Lua code.
==See also==
* Lua Wikipedia article
==References==
Category:Lua
ru:Lua