mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
16 lines
313 B
Rust
16 lines
313 B
Rust
use mlua::{Lua, UserDataMethods};
|
|
|
|
fn main() {
|
|
let lua = Lua::new();
|
|
|
|
lua.register_userdata_type::<String>(|reg| {
|
|
let s = String::new();
|
|
let mut s = &s;
|
|
reg.add_async_method("t", |_, this, ()| async {
|
|
s = &*this;
|
|
Ok(())
|
|
});
|
|
})
|
|
.unwrap();
|
|
}
|