mlua-check
Lua checker on mlua — undefined variable / global / field detection with LuaCats support.
Designed to run before Lua execution, providing a safety net for AI-driven and programmatic Lua code generation.
Features
- Undefined variable — reference to a variable not defined in any enclosing scope
- Undefined global — reference to a global name not in the known symbol table
- Undefined field — access to a field not declared in a
---@classdefinition - Unused variable — a local variable that is declared but never referenced
- VM introspection — automatically builds symbol table from live
mluaglobals
Quick start
let result = run_lint.unwrap;
assert_eq!;
With an existing VM
use *;
use register;
let lua = new;
let alc = lua.create_table.unwrap;
alc.set.unwrap;
lua.globals.set.unwrap;
// register() introspects the VM and builds a symbol table automatically
let engine = register.unwrap;
let result = engine.lint;
assert_eq!;
let result = engine.lint;
assert!;
Configuration
use ;
let config = default.with_policy;
| Policy | Behavior |
|---|---|
Strict |
Lint errors block execution |
Warn |
Issues reported, execution proceeds (default) |
Off |
Linting disabled |
License
Licensed under either of
at your option.