Lua from Modern Roblox (Luau)

From Legacy Roblox Wiki
Jump to navigationJump to search
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

Modern documentation

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. Instead, use coroutine, delay, spawn, and wait, or alternative implementations of these.

utf8

In later versions, the utf8 library provides basic support for UTF-8 encoding. It is unavailable here.

Globals

Lua Globals

Modern documentation

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

Modern documentation

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

Modern documentation

The DebuggerManager function is unavailable.

elapsedTime()

Modern documentation

The elapsedTime function is unavailable.

PluginManager()

Modern documentation

The PluginManager function is available in clients with plugin support (August 2011+).

require()

Modern documentation

The require function is unavailable. (ModuleScripts were added in 2013.)

typeof()

Modern documentation

The typeof function is unavailable. To get the type of standard Lua data types, use Lua 5.1's built in type function.

UserSettings()

Modern documentation

The UserSettings function is available in 2011+ clients.

warn()

Modern documentation

The warn function is unavailable.

Properties

plugin

Modern documentation

The plugin property is available in clients with plugin support (August 2011+).

Data Types

Axes

BrickColor

CatalogSearchParams

CFrame

Modern documentation

Constructors

CFrame.lookAt()

Modern documentation

The lookAt function is unavailable. Instead, use CFrame.new(pos, lookAt) if up is not something other than Vector3.new(0, 1, 0).

CFrame.lookAlong()

Modern documentation

The lookAlong function is unavailable.

CFrame.fromEulerAngles()

Modern documentation

The fromEulerAngles function is unavailable.

CFrame.fromEulerAnglesYXZ()

Modern documentation

The fromEulerAnglesYXZ function is unavailable.

CFrame.Angles()

Modern documentation

The Angles function is available in 2010+ clients. For older clients, use the equivalent fromEulerAnglesXYZ function.

CFrame.fromOrientation()

Modern documentation

The fromOrientation function is unavailable.

CFrame.fromAxisAngle()

Modern documentation

The fromOrientation function is unavailable.

CFrame.fromMatrix()

Modern documentation

The fromMatrix function is unavailable.

Properties

CFrame.identity

Modern documentation

The identity property is unavailable.

CFrame.Position

Modern documentation

The Position property is unavailable. Instead, use the equivalent p property.

CFrame.Rotation

Modern documentation

The Rotation property is unavailable.

CFrame.LookVector

Modern documentation

The LookVector property is unavailable. Instead, use the equivalent lookVector (lowercase first letter) property.

CFrame.RightVector

Modern documentation

The RightVector property is unavailable.

CFrame.UpVector

Modern documentation

The UpVector property is unavailable.

CFrame.XVector

Modern documentation

The XVector property is unavailable.

CFrame.YVector

Modern documentation

The YVector property is unavailable.

CFrame.ZVector

Modern documentation

The ZVector property is unavailable.

Methods

CFrame:Inverse

Modern documentation

The Inverse method is unavailable. Instead, use the equivalent inverse (lowercase first letter) method.

Color3

ColorSequence

ColorSequenceKeypoint

Content

DateTime

DockWidgetPluginGuiInfo

Enum

EnumItem

Enums

Faces

FloatCurveKey

Font

Instance

NumberRange

NumberSequence

NumberSequenceKeypoint

OverlapParams

Path2DControlPoint

PathWaypoint

PhysicalProperties

Random

Ray

RaycastParams

RaycastResult

RBXScriptConnection

RBXScriptSignal

Rect

Region3

Region3int16

Secret

SharedTable

TweenInfo

UDim

UDim2

Vector2

Vector2int16

Vector3

Vector3int16