Luau globals

Show Deprecated

The following is a list of functions and variables that are native to Luau. These functions can be used in a standard installation of both Luau and Lua 5.1.4, though there are some differences in how some of these work on Roblox.

Summary

Functions

  • assert(value : Variant,errorMessage : string):Variant

    Throws an error if the provided value resolves to false or nil.

  • error(message : Variant,level : number):()

    Halts thread execution and throws an error.

  • Returns the total memory heap size in kilobytes.

  • getmetatable(t : Variant):Variant

    Returns the metatable of the given table.

  • Returns an iterator function and the table for use in a for loop.

  • loadstring(contents : string,chunkname : string):Variant

    Returns the provided code as a function that can be executed.

  • newproxy(addMetatable : boolean):userdata

    Creates a blank userdata, with the option for it to have a metatable.

  • next(t : table,lastKey : Variant):Variant,Variant

    An iterator function for use in for loops.

  • Returns an iterator function and the provided table for use in a for loop.

  • pcall(func : function,args : Tuple):boolean,Variant

    Runs the provided function and catches any error it throws, returning the function's success and its results.

  • print(params : Tuple):()

    Prints all provided values to the output.

  • rawequal(v1 : Variant,v2 : Variant):boolean

    Returns whether v1 is equal to v2, bypassing their metamethods.

  • rawget(t : table,index : Variant):Variant

    Gets the real value of table[index], bypassing any metamethods.

  • Returns the length of the string or table, bypassing any metamethods.

  • rawset(t : table,index : Variant,value : Variant):table

    Sets the real value of table[index], bypassing any metamethods.

  • require(module : ModuleScript | string | number):Variant

    Returns the value that was returned by the given ModuleScript, running it if it has not been run yet.

  • select(index : Variant,args : Tuple):Tuple

    Returns all arguments after the given index.

  • setmetatable(t : table,newMeta : Variant):table

    Sets the given table's metatable.

  • tonumber(arg : Variant,base : number):Variant

    Returns the provided value converted to a number, or nil if impossible.

  • tostring(e : Variant):string

    Returns the provided value converted to a string, or nil if impossible.

  • type(v : Variant):string

    Returns the basic type of the provided object.

  • unpack(list : table,i : number,j : number):Variant

    Returns all elements from the given list as a tuple.

  • xpcall(f : function,err : function,args : Tuple):boolean,Variant

    Similar to pcall() except it uses a custom error handler.

Properties

  • A table that is shared between all scripts of the same context level.

  • A global variable that holds a string containing the current interpreter version.

Functions

assert

Variant

Parameters

value: Variant
errorMessage: string
Default Value: assertion failed!

Returns

Variant

error

()

Parameters

message: Variant
level: number
Default Value: 1

Returns

()

gcinfo

Returns

getmetatable

Variant

Parameters

t: Variant

Returns

Variant

ipairs

Parameters

loadstring

Variant

Parameters

contents: string
chunkname: string

Returns

Variant

newproxy

Parameters

addMetatable: boolean
Default Value: false

Returns

Parameters

pcall

Parameters

func: function
args: Tuple

Returns

Variant

print

()

Parameters

params: Tuple

Returns

()

rawequal

Parameters

v1: Variant
v2: Variant

Returns

rawget

Variant

Parameters

index: Variant

Returns

Variant

rawlen

Parameters

Returns

rawset

Parameters

index: Variant
value: Variant

Returns

require

Variant

Parameters

Returns

Variant

select

Parameters

index: Variant
args: Tuple

Returns

setmetatable

Parameters

newMeta: Variant

Returns

tonumber

Variant

Parameters

arg: Variant
base: number
Default Value: 10

Returns

Variant

tostring

Parameters

e: Variant

Returns

type

Parameters

v: Variant

Returns

unpack

Variant

Parameters

list: table
Default Value: 1
Default Value: #list

Returns

Variant

xpcall

Parameters

args: Tuple

Returns

Variant

Properties

_VERSION