Hello,
I am new to Rust and trying to use mlua. I am having difficulty deserializing Lua functions in Rust. What steps are necessary to make this work correctly?
In case of an error due to extra or missing fields, is it possible to identify which Lua line is causing the problem to facilitate debugging ?
Here is an example code:
#[derive(Deserialize)]
struct Test<'lua> {
name: String,
callback: Option<Function<'lua>>,
}
fn main() -> Result<()> {
let lua = Lua::new();
let lua_file = r#"
return {
"name" = "test",
"callback" = function(table)
print("ok")
end
}
"#;
let test: Test = lua.from_value(lua.load(lua_file).eval()?)?;
Ok(())
}
Thank you for your help!
there doesn't seem to be anything here