Skip to main content

run_lint

Function run_lint 

Source
pub fn run_lint(
    code: &str,
    chunk_name: &str,
    search_paths: &[&str],
) -> Result<LintResult, String>
Expand description

One-shot lint: creates a fresh Lua VM, collects stdlib symbols, and lints.

search_paths is prepended to package.path so that the VM can resolve project-specific modules when building the symbol table. Pass &[] when no extra paths are needed.

let result = mlua_check::run_lint("print('hello')", "@test.lua", &[]).unwrap();
assert_eq!(result.diagnostics.len(), 0);