pub fn lint(
lua: &Lua,
code: &str,
chunk_name: &str,
) -> Result<LintResult, Error>Expand description
Lint code against an existing VM’s environment.
Convenience wrapper that calls register and then LintEngine::lint.
use mlua::prelude::*;
let lua = Lua::new();
lua.globals().set("custom_fn",
lua.create_function(|_, ()| Ok(42)).unwrap()
).unwrap();
let result = mlua_check::lint(&lua, "custom_fn()", "@test.lua").unwrap();
assert_eq!(result.diagnostics.len(), 0);