1 2 3 4 5 6 7 8 9 10 11 12 13 14
#[derive(Default, mlua::UserData)] struct Foo { x: u32, } #[mlua::userdata_impl] impl Foo { #[lua(field)] fn as_name(name: &str) -> String { name.to_string() } } fn main() {}