CompileMode enum

How Lua scripts should be compiled and embedded.

Each mode targets a different runtime strategy:

  • CompileMode.bytecode -- Compiles to Lua 5.5 bytecode and writes .lua files to build/<outputDirName>/. At runtime, load the bytes with rootBundle.load() (Flutter) or LuaAssetLoader (Dart CLI) and execute via LuaBytecodeRuntime.

  • CompileMode.dartSource -- Compiles to Dart source code that embeds the bytecode as a literal list. The generated .dart file imports the lualike runtime and can be imported directly. No asset loading needed at runtime.

  • CompileMode.dartEmbed -- Compiles to Lua bytecode, then wraps the bytes in a Dart file as a List<int> constant. Similar to --dart-output from the lualike CLI. The generated file exports a single top-level variable containing the raw bytecode bytes.

Inheritance
Available extensions

Values

bytecode → const CompileMode

Compile Lua source to Lua 5.5 bytecode files.

Output: build/<outputDirName>/*.lua (binary bytecode)

Runtime: Load bytes via asset bundle or file, execute with LuaBytecodeRuntime.

dartSource → const CompileMode

Compile Lua source to standalone Dart source code.

Output: build/<outputDirName>/*.lua.dart (Dart source)

Runtime: Import the generated .dart file and call the emitted function directly. No asset loading or bytecode VM needed.

dartEmbed → const CompileMode

Compile Lua source to bytecode, then embed as a Dart literal.

Output: build/<outputDirName>/*.lua.dart (Dart source with final List<int> scriptModule = <int>[...];)

Runtime: Import the generated file, pass the byte list to LuaBytecodeRuntime.loadBytecode().

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<CompileMode>
A constant List of the values in this enum, in order of their declaration.