API Reference Lua v#1.0.0-rc.0
View SourceModules
Lua is an Elixir-native Lua 5.3 virtual machine. It runs Lua code on the BEAM
with no Erlang or C dependencies, and exposes an ergonomic Elixir API for
embedding Lua scripting in your application.
Defines the Behaviour for defining a Lua API
Represents a block of statements in Lua.
Helpers for programmatically constructing AST nodes.
Represents the top-level chunk (file or string) in Lua.
Expression AST nodes for Lua.
Represents a binary operation.
Represents boolean literals (true or false)
Represents a function call: func(args)
Represents a function expression: function(params) body end
Represents indexing with brackets: table[key]
Represents a method call: obj:method(args)
Represents the nil literal
Represents numeric literals (integers and floats)
Represents property access: table.field
Represents string literals
Represents a table constructor: {...}
Represents a unary operation.
Represents a variable reference
Represents the vararg expression: ...
Position tracking metadata for AST nodes.
Converts AST back to Lua source code.
Statement AST nodes for Lua.
Represents an assignment statement: targets = values
Represents a break statement: break
Represents a function call as a statement.
Represents a do block: do block end
Represents a generic for loop: for vars in exprs do block end
Represents a numeric for loop: for var = start, limit, step do block end
Represents a function declaration: function name(params) body end
Represents a goto statement: goto label
Represents an if statement with optional elseif and else clauses.
Represents a label: ::label::
Represents a local variable declaration: local names = values
Represents a local function declaration: local function name(params) body end
Represents a repeat-until loop: repeat block until condition
Represents a return statement: return exprs
Represents a while loop: while condition do block end
AST traversal utilities using the visitor pattern.
Public API for the Lua compiler.
Bytecode encoder for Lua.Compiler.Prototype.
Constructor functions for Lua VM instructions.
Represents a compiled Lua function prototype.
Raised when Lua source cannot be lexed, parsed, or compiled. Carries
a list of formatted error messages in :errors.
Hand-written lexer for Lua 5.3 using Elixir binary pattern matching.
Hand-written recursive descent parser for Lua 5.3.
Helper functions for collecting and attaching comments to AST nodes.
Beautiful error reporting for the Lua parser.
Pratt parser for Lua expressions.
Error recovery strategies for the Lua parser.
Tracks unclosed delimiters in a stack-based manner.
Raised when a Lua program fails at runtime — bad argument types,
arithmetic on a non-number, indexing a nil, an explicit error()
call from Lua, or any other dynamic failure inside the VM.
In Lua, tables are the fundamental datastructure, which are used both as associative arrays (maps), and arrays (lists).
Public API for the Lua Virtual Machine.
Raised when a function is called with invalid arguments.
Raised by the Lua assert() function when the condition is falsy.
Hand-written executor over the dense bytecode produced by
Lua.Compiler.Bytecode.
Boundary wrappers that turn opaque VM value tags into display
structs at the Lua.eval!/2 return path.
Display wrapper for a Lua closure ({:lua_closure, proto, upvalues})
returned across the Lua.eval!/2 boundary.
Display wrapper for a native Elixir-backed Lua function
({:native_func, fun}) returned across the Lua.eval!/2 boundary.
Display wrapper for a Lua table reference returned across the
Lua.eval!/2 boundary in decode: false mode.
Display wrapper for a Lua userdata reference ({:udref, id})
returned across the Lua.eval!/2 boundary in
decode: false mode.
Beautiful error formatting for Lua runtime errors.
Instruction executor for the Lua VM.
Raised for internal VM errors: bad native function returns, unimplemented instructions, and other invariant violations.
Numeric helpers implementing Lua 5.3 integer semantics.
Raised by the Lua error() function.
Runtime state for the Lua VM.
Standard library functions for the Lua VM.
Lua 5.3 debug standard library.
Behaviour for Lua standard library modules.
Lua 5.3 math standard library.
Lua 5.3 pattern matching engine.
String standard library functions for Lua 5.3.
Implementation of string.pack/2, string.unpack/2,3, and
string.packsize/1 per Lua 5.3 §6.4.2.
Lua 5.3 table standard library.
Lua table data structure.
Raised when a Lua operation is applied to a value of the wrong type.
Shared utilities for working with Lua values in the VM.
Mix Tasks
Runs one of the Benchee scripts in benchmarks/.
Evaluates a Lua source file in a fresh Lua.new() VM and prints
any return values.
Downloads the official Lua 5.3 test suite.
Runs every .lua file in test/lua53_tests/ against this VM and
prints a pass/fail summary.