Lua from Modern Roblox (Luau): Difference between revisions
add info for globals and part-way through cframe |
|||
Line 2: | Line 2: | ||
<!-- TODO: | |||
the rest of it. | |||
as well as go back and provide links to both modern documentation and, if it exists, documentation here on each thing, function, property, etc. --> | |||
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"). | 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"). | ||
Line 9: | Line 12: | ||
== Libraries == | == Libraries == | ||
[https://create.roblox.com/docs/en-us/reference/engine/libraries Modern documentation] | |||
=== bit32 === | === bit32 === | ||
The bit32 library provides functions to perform bitwise operations. It was a backported feature from Lua 5.2, so it is unavailable. | 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. | |||
=== [[Function Dump/Coroutine Manipulation|coroutine]] === | === [[Function Dump/Coroutine Manipulation|coroutine]] === | ||
Line 97: | Line 106: | ||
=== Lua Globals === | === Lua Globals === | ||
[https://create.roblox.com/docs/en-us/reference/engine/globals/LuaGlobals 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() ==== | |||
[https://create.roblox.com/docs/reference/engine/globals/LuaGlobals#rawlen Modern documentation] | |||
The rawlen function is unavailable. | |||
=== Roblox Global Properties === | |||
[https://create.roblox.com/docs/en-us/reference/engine/globals/RobloxGlobals 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() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/globals/RobloxGlobals#DebuggerManager Modern documentation] | |||
The DebuggerManager function is unavailable. | |||
===== elapsedTime() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/globals/RobloxGlobals#elapsedTime Modern documentation] | |||
The elapsedTime function is unavailable. | |||
===== PluginManager() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/globals/RobloxGlobals#PluginManager Modern documentation] | |||
The PluginManager function is available in clients with plugin support (August 2011+). | |||
===== require() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/globals/RobloxGlobals#require Modern documentation] | |||
The require function is unavailable. (ModuleScripts were added in 2013.) | |||
===== typeof() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/globals/RobloxGlobals#typeof Modern documentation] | |||
=== | The typeof function is unavailable. To get the type of standard Lua data types, use Lua 5.1's built in <code>type</code> function. | ||
===== UserSettings() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/globals/RobloxGlobals#typeof Modern documentation] | |||
The UserSettings function is available in 2011+ clients. | |||
===== warn() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/globals/RobloxGlobals#warn Modern documentation] | |||
The warn function is unavailable. | |||
==== Properties ==== | |||
===== plugin ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/globals/RobloxGlobals#plugin Modern documentation] | |||
The plugin property is available in clients with plugin support (August 2011+). | |||
== Data Types == | == Data Types == | ||
=== CFrame === | === [[Axes]] === | ||
=== [[BrickColor]] === | |||
=== CatalogSearchParams === | |||
=== [[CFrame]] === | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame Modern documentation] | |||
==== Constructors ==== | |||
===== CFrame.lookAt() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#lookAt Modern documentation] | |||
The lookAt function is unavailable. | |||
===== CFrame.lookAlong() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#lookAlong Modern documentation] | |||
The lookAlong function is unavailable. | |||
===== CFrame.fromEulerAngles() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#fromEulerAngles Modern documentation] | |||
The fromEulerAngles function is unavailable. | |||
===== CFrame.fromEulerAnglesYXZ() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#fromEulerAnglesYXZ Modern documentation] | |||
The fromEulerAnglesYXZ function is unavailable. | |||
===== CFrame.Angles() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#Angles Modern documentation] | |||
The Angles function is available in 2010+ clients. For older clients, use the equivalent fromEulerAnglesXYZ function. | |||
===== CFrame.fromOrientation() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#fromOrientation Modern documentation] | |||
The fromOrientation function is unavailable. | |||
===== CFrame.fromAxisAngle() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#fromOrientation Modern documentation] | |||
The fromOrientation function is unavailable. | |||
===== CFrame.fromMatrix() ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#fromMatrix Modern documentation] | |||
The fromMatrix function is unavailable. | |||
==== Properties ==== | |||
===== CFrame.identity ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#identity Modern documentation] | |||
The identity property is unavailable. | |||
===== CFrame.Position ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#Position Modern documentation] | |||
The Position property is unavailable. Instead, use the equivalent <code>p</code> property. | |||
===== CFrame.Rotation ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#Rotation Modern documentation] | |||
The Rotation property is unavailable. | |||
===== CFrame.LookVector ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#LookVector Modern documentation] | |||
The LookVector property is unavailable. Instead, use the equivalent <code>lookVector</code> (lowercase first letter) property. | |||
===== CFrame.RightVector ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#RightVector Modern documentation] | |||
The RightVector property is unavailable. | |||
===== CFrame.UpVector ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#UpVector Modern documentation] | |||
The UpVector property is unavailable. | |||
===== CFrame.XVector ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#XVector Modern documentation] | |||
The XVector property is unavailable. | |||
===== CFrame.YVector ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#YVector Modern documentation] | |||
The YVector property is unavailable. | |||
===== CFrame.ZVector ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#ZVector Modern documentation] | |||
The ZVector property is unavailable. | |||
==== Methods ==== | |||
===== CFrame:Inverse ===== | |||
[https://create.roblox.com/docs/en-us/reference/engine/datatypes/CFrame#Inverse Modern documentation] | |||
The Inverse method is unavailable. Instead, use the equivalent <code>inverse</code> (lowercase first letter) method. | |||
=== [[Color3]] === | |||
=== ColorSequence === | |||
=== ColorSequenceKeypoint === | |||
=== Content === | |||
=== DateTime === | |||
=== DockWidgetPluginGuiInfo === | |||
=== [[Enum]] === | |||
=== EnumItem === | |||
=== [[Enums]] === | |||
=== [[Faces (DataType)|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 === |
Revision as of 21:30, 11 March 2024
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.