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
| Entry | Description |
|---|---|
| Bytecode | Compiled Luau bytecode produced by luau.compile. |
| RequireNode | A require(...) call found in a source file, with its resolved absolute path and the raw require string. |
| Type | A Luau type, representing the type of a value or expression. |
| TypePack | A Luau type pack, representing a sequence of types. |
| compile | Compiles Luau source code into bytecode. |
| load | Loads bytecode into a callable function. chunkname names the chunk for error messages. |
| loadModule | Loads and executes the Luau file at requirePath, returning its result. |
| requires | Returns all require(...) calls found in the file at filePath, with resolved absolute paths where available. |
| resolveModule | Resolves the require path modulepath relative to frompath, returning the absolute path. |
| typeofModule | Returns 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.
type Bytecode = luteLuau.BytecodeRequireNode
A require(...) call found in a source file, with its resolved absolute path and the raw require string.
type RequireNode = {
resolvedPath: string?,
requirePath: string?,
requireExpr: luteLuau.CstExprCall,
}Type
A Luau type, representing the type of a value or expression.
type Type = luteLuau.TypeTypePack
A Luau type pack, representing a sequence of types.
type TypePack = luteLuau.TypePackFunctions and Properties
luau.compile
Compiles Luau source code into bytecode.
(source: string) -> Bytecodeluau.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.
(bytecode: Bytecode, chunkname: string?, env: { [any]: any }?) -> (...any) -> ...anyluau.loadModule
Loads and executes the Luau file at requirePath, returning its result.
An optional env table can be provided to override the global environment.
(requirePath: path.Pathlike, env: { [any]: any }?) -> anyluau.requires
Returns all require(...) calls found in the file at filePath, with resolved absolute paths where available.
(filePath: path.Pathlike) -> { RequireNode }luau.resolveModule
Resolves the require path modulepath relative to frompath, returning the absolute path.
(modulepath: string, frompath: path.Pathlike) -> path.Pathlikeluau.typeofModule
Returns the type pack representing the return types of the module at modulepath, or nil if unavailable.
(modulepath: path.Pathlike) -> TypePack?