Skip to Content
Skip to Content

Luau

ℹ️
Page is being worked on.

Functions

  1. compile
  2. load

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:

  • nativeCodeGen will be disabled if env field is not a regular table (non-metatable).
  • If env is not provided, it will default to the global environment.
    • If the global environment is an unsafe environment, nativeCodeGen will not work, it would better to pass a new table with NCG enabled.
  • If chunkName is 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