Skip to main content

register

Function register 

Source
pub fn register(lua: &Lua) -> LuaResult<LintEngine>
Expand description

Register the linter on an existing Lua VM.

Introspects lua.globals() to build the symbol table automatically. Returns a configured LintEngine ready to lint code against this VM’s environment.

§Example

use mlua::prelude::*;
use mlua_check::register;

let lua = Lua::new();
// Register custom globals
lua.globals().set("my_api", lua.create_table().unwrap()).unwrap();

let engine = register(&lua).unwrap();
let result = engine.lint("my_api.something()", "@test.lua");
// my_api is known, but "something" field was not registered on the table