Skip to content

Commit

Permalink
refactor(core): Avoid chunk execution when enabled by mlua v0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Oct 31, 2024
1 parent 9c07677 commit 98eca6e
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,15 @@ pub fn run(
sile_input.set("options", options)?;
}
if let Some(modules) = uses {
// let parser_bits: LuaTable = sile.get("parserBits")?;
// let cliuse: LuaAnyUserData = parser_bits.get("cliuse")?;
// sile_input.get("uses")?;
let parser_bits: LuaTable = sile.get("parserBits")?;
let cliuse: LuaAnyUserData = parser_bits.get("cliuse")?;
let input_uses: LuaTable = sile_input.get("uses")?;
for module in modules.iter() {
let module = lua.create_string(module)?;
lua.load(chunk! {
local spec = SILE.parserBits.cliuse:match($module);
table.insert(SILE.input.uses, spec)
})
.set_name("cli --uses flag parser")
.eval::<()>()?;
// let spec = cliuse.call_function::<_, _, _>("match", module);
let spec: LuaTable = cliuse
.call_method::<_>("match", module)
.context("failed to call `cliuse:match()`")?;
let _ = input_uses.push(spec);
}
}
if !quiet {
Expand Down

0 comments on commit 98eca6e

Please sign in to comment.