kui-lua
Lua scripts as kui extensions: a script returns its view as a table tree and gets events back as tables.
kui-lua loads a Lua script as an extension a kui host can place in its frame. The script defines view(env, slot), which returns a plain table built with the injected row / column / text / button prelude, and optionally on_event(ev), which hears the events the script's own nodes emit and may return replies for the host. Only data crosses the boundary: no closure lives on either side. Use it when a Rust app on kui wants scriptable panels or plugins.
Install
cargo add kui-lua kui-native
Example
The Rust host reserves a position for the script under a namespace and hears its replies:
use LuaExtension;
use ;
panel.lua fills the panel slot, reads the host's params and replies with the host's template:
slots =
local done =
local on_toggle
The crate docs list everything a script gets: the builders, the env facts and functions, the slot argument, the props shapes, and kui_lua::luals_meta() for editor completion.
Where it fits
| Crate | Role |
|---|---|
| kui-core | The model and layout |
| kui-wgpu | The renderer |
| kui-native | The windowed runner most apps use |
| kui-derive | #[derive(Message)] |
| kui-ffi | The C API and plugin loader |
| kui-lua | Lua scripts as extensions (this crate) |
| @qxuken/kui | The Node.js package |
Documentation
- API: https://docs.rs/kui-lua
- Book: https://kui-book.qxuken.dev
- Repository: https://github.com/qxuken/kui
License
MIT