Lua from Modern Roblox (Luau)
Work In Progress This is currently being worked on! Check back later for more information... hopefully. |
Lua in classic versions of Roblox does not differ much from the current year fundamentally - mostly just the lack of certain Lua functions. This page aims to document the majority of unavailable features as well as provide workarounds (AKA "polyfills").
Modern versions of Roblox use Luau, a scripting language heavily based on Lua 5.1 with performance and utility improvements. Luau is open-source.
Before Luau, Roblox used Lua 5.1, adding backported features over time. In classic versions (2006-2012), there are no backported features from later versions of Lua (as far as we know).
Libraries
bit32
The bit32 library provides functions to perform bitwise operations. It was a backported feature from Lua 5.2, so it is unavailable.
buffer
A buffer is an object that represents a fixed-size mutable block of memory. The buffer library provides functions for creation and manipulation of buffer objects, providing all its functions inside the global buffer variable. Buffer provides a simple and faster way of working with compact binary data.
Here, it is unavailable.
coroutine
The coroutine library provides coroutines, allowing multiple tasks to be performed at the same time within a single script.
coroutine.close()
The close function is unavailable.
coroutine.isyieldable()
The isyieldable function is unavailable.
debug
The debug library is a native Lua library providing basic functions for debugging code. In later versions, it is available as a heavily sandboxed version. Here, it is unavailable.
math
The math library is an interface to the standard C math library, providing mathematical functions.
math.clamp()
The clamp function is unavailable.
math.noise()
The noise function is unavailable.
math.round()
The round function is unavailable.
math.sign()
The sign function is unavailable.
os
The os library is a native Lua library providing information about the system. In later versions, it's available as a heavily sandboxed version exclusively to provide system time information. Here, it is unavailable.
string
The string library provides string manipulation functions.
string.pack()
The pack function is unavailable.
string.packsize()
The packsize function is unavailable.
string.split()
The split function is unavailable.
string.unpack()
The unpack function is unavailable.
table
The table library provides table/array manipulation functions.
table.clear()
The clear function is unavailable.
table.clone()
The clone function is unavailable.
table.create()
The create function is unavailable.
table.find()
The find function is unavailable.
table.freeze()
The freeze function is unavailable.
table.isfrozen()
The isfrozen function is unavailable.
table.move()
The move function is unavailable.
table.pack()
The pack function is unavailable.
table.unpack()
The unpack function is unavailable.
task
In later versions, the task library allows for functions and threads to be scheduled with the Task Scheduler. It is unavailable here.
utf8
In later versions, the utf8 library provides basic support for UTF-8 encoding. It is unavailable here.
Globals
Lua Globals
The following is a list of functions and variables that are native to Lua. These functions can be used in a standard installation of Lua 5.1.4, though there are some differences in how some of these work on Roblox.
rawlen()
The rawlen function is unavailable.
Roblox Global Properties
Modern documentation link Roblox has several unique built-in functions and variables in its Lua implementation. These are only found on Roblox and are not packaged by default with Lua.
Functions
DebuggerManager()
The DebuggerManager function is unavailable.
elapsedTime()
The elapsedTime function is unavailable.
PluginManager()
The PluginManager function is available in clients with plugin support (August 2011+).
require()
The require function is unavailable. (ModuleScripts were added in 2013.)
typeof()
The typeof function is unavailable. To get the type of standard Lua data types, use Lua 5.1's built in type
function.
UserSettings()
The UserSettings function is available in 2011+ clients.
warn()
The warn function is unavailable.
Properties
plugin
The plugin property is available in clients with plugin support (August 2011+).
Data Types
Axes
BrickColor
CatalogSearchParams
CFrame
Constructors
CFrame.lookAt()
The lookAt function is unavailable.
CFrame.lookAlong()
The lookAlong function is unavailable.
CFrame.fromEulerAngles()
The fromEulerAngles function is unavailable.
CFrame.fromEulerAnglesYXZ()
The fromEulerAnglesYXZ function is unavailable.
CFrame.Angles()
The Angles function is available in 2010+ clients. For older clients, use the equivalent fromEulerAnglesXYZ function.
CFrame.fromOrientation()
The fromOrientation function is unavailable.
CFrame.fromAxisAngle()
The fromOrientation function is unavailable.
CFrame.fromMatrix()
The fromMatrix function is unavailable.
Properties
CFrame.identity
The identity property is unavailable.
CFrame.Position
The Position property is unavailable. Instead, use the equivalent p
property.
CFrame.Rotation
The Rotation property is unavailable.
CFrame.LookVector
The LookVector property is unavailable. Instead, use the equivalent lookVector
(lowercase first letter) property.
CFrame.RightVector
The RightVector property is unavailable.
CFrame.UpVector
The UpVector property is unavailable.
CFrame.XVector
The XVector property is unavailable.
CFrame.YVector
The YVector property is unavailable.
CFrame.ZVector
The ZVector property is unavailable.
Methods
CFrame:Inverse
The Inverse method is unavailable. Instead, use the equivalent inverse
(lowercase first letter) method.