Luau
ℹ️
Page is being worked on.
Functions
Functions
compile
luau.compile(source: string, options: CompileOptions?): (boolean, string)Compiles Luau source code.
Parameters
source: string- The source code to compile.options:CompileOptions?- The options for the compilation.
Returns
boolean- Whether the operation was successful.string- The compiled source code or compile error.
load
luau.load(bytecode: string, options: LoadOptions?): ((...any) -> (...any))️⚠️
Can Error
Loads Luau source code.
Notes:
nativeCodeGenwill be disabled ifenvfield is not a regular table (non-metatable).- If
envis not provided, it will default to the global environment.- If the global environment is an unsafe environment,
nativeCodeGenwill not work, it would better to pass a new table with NCG enabled.
- If the global environment is an unsafe environment,
- If
chunkNameis not provided, it will default to(load).
Parameters
bytecode: string- The bytecode to load.options:LoadOptions?- The options for the load.
Returns
(...any) -> (...any)- The loaded function.
Throws
- If the bytecode is invalid, an error will be thrown.
Types
CompileOptions
export type CompileOptions = {
debug_level : number?,
optimization_level : number?,
coverage_level : number?,
}LoadOptions
export type LoadOptions = {
env : {[any]: any}?,
chunkName : string?,
nativeCodeGen : boolean?,
}Last updated on