-
-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
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#"
{
"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!
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested