Skip to content

luau ​

luau
local luau = require("@std/luau")

WARNING

These APIs are still open to future evolution. In new major versions, they may change in backwards incompatible ways.

Summary ​

EntryDescription
BytecodeCompiled Luau bytecode produced by luau.compile.
RequireNodeA require(...) call found in a source file, with its resolved absolute path and the raw require string.
TypeA Luau type, representing the type of a value or expression.
TypePackA Luau type pack, representing a sequence of types.
compileCompiles Luau source code into bytecode.
loadLoads bytecode into a callable function. chunkname names the chunk for error messages.
loadModuleLoads and executes the Luau file at requirePath, returning its result.
requiresReturns all require(...) calls found in the file at filePath, with resolved absolute paths where available.
resolveModuleResolves the require path modulepath relative to frompath, returning the absolute path.
typeofModuleReturns the type pack representing the return types of the module at modulepath, or nil if unavailable.

Types ​

Bytecode ​

Compiled Luau bytecode produced by luau.compile.

luau
type Bytecode = luteLuau.Bytecode

RequireNode ​

A require(...) call found in a source file, with its resolved absolute path and the raw require string.

luau
type RequireNode = {
	resolvedPath: string?,
	requirePath: string?,
	requireExpr: cst.CstExprCall,
}

Type ​

A Luau type, representing the type of a value or expression.

luau
type Type = luteLuau.Type

TypePack ​

A Luau type pack, representing a sequence of types.

luau
type TypePack = luteLuau.TypePack

Functions and Properties ​

luau.compile ​

Compiles Luau source code into bytecode.

luau
(source: string) -> Bytecode

luau.load ​

Loads bytecode into a callable function. chunkname names the chunk for error messages.

An optional env table can be provided to override the global environment for the loaded chunk.

luau
(bytecode: Bytecode, chunkname: string?, env: { [any]: any }?) -> (...any) -> ...any

luau.loadModule ​

Loads and executes the Luau file at requirePath, returning its result.

An optional env table can be provided to override the global environment.

luau
(requirePath: path.Pathlike, env: { [any]: any }?) -> any

luau.requires ​

Returns all require(...) calls found in the file at filePath, with resolved absolute paths where available.

luau
(filePath: path.Pathlike) -> { RequireNode }

luau.resolveModule ​

Resolves the require path modulepath relative to frompath, returning the absolute path.

luau
(modulepath: string, frompath: path.Pathlike) -> path.Pathlike

luau.typeofModule ​

Returns the type pack representing the return types of the module at modulepath, or nil if unavailable.

luau
(modulepath: path.Pathlike) -> TypePack?