Open
Description
Something like would be great:
#[lua-userdata]
struct Foo {
value: int,
}
#[lua-userdata]
impl Foo {
pub fn get_value(&self) -> int {
self.value
}
}
lua.set("foo", Foo{ value: 5 }); // automatically fills the metatable
lua.execute("return foo:get_value()"); // would return 5
There are probably technical limitations, limiting this syntax extension to a single impl
block, but maybe there's a trick that I didn't think about.