Expand description
rilua — Lua 5.1.1 implemented in Rust.
A from-scratch implementation targeting behavioral equivalence with the PUC-Rio reference interpreter. Designed for embedding in Rust applications, with a focus on the World of Warcraft addon variant.
§Architecture
Pipeline: Source -> Lexer -> Parser -> AST -> Compiler -> Proto -> VM
See docs/architecture.md for design documentation.
§Usage
use rilua::Lua;
let mut lua = Lua::new().unwrap();
lua.exec("print(1 + 2)").unwrap();
lua.set_global("x", 42.0).unwrap();
let x: f64 = lua.global("x").unwrap();
assert_eq!(x, 42.0);Re-exports§
pub use conversion::FromLua;pub use conversion::FromLuaMulti;pub use conversion::IntoLua;pub use conversion::IntoLuaMulti;pub use error::LuaError;pub use error::LuaResult;pub use error::RuntimeError;pub use error::runtime_error;pub use handles::AnyUserData;pub use handles::Function;pub use handles::Table;pub use handles::Thread;pub use stdlib::StdLib;pub use vm::closure::RustFn;pub use vm::state::ThreadStatus;pub use vm::value::Val;
Modules§
- compiler
- Compilation pipeline: source code to bytecode.
- conversion
- Type conversion traits for moving values between Rust and Lua.
- error
- Error types for rilua.
- handles
- Handle types for Lua objects.
- stdlib
- Standard library: modular implementation of Lua 5.1.1’s built-in libraries.
- vm
- Virtual machine: bytecode execution and runtime state.
Structs§
- Lua
- A Lua interpreter instance.
Functions§
- clear_
interrupted - Clears the interrupt flag.
- exec
- Executes Lua source bytes as
"=(string)". - exec_
with_ name - Executes Lua source bytes with the given chunk name.
- set_
interrupted - Sets the interrupt flag.