mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
3641c98959
Replace `IntoLua(Multi)` generic with positional arg (impl trait) where possible This allow to shorten syntax from `a.get::<_, T>` to `a.get::<T>`
27 lines
488 B
Rust
27 lines
488 B
Rust
use std::os::raw::c_void;
|
|
|
|
use mlua::{Function, LightUserData, Lua, Result};
|
|
|
|
#[test]
|
|
fn test_lightuserdata() -> Result<()> {
|
|
let lua = Lua::new();
|
|
|
|
let globals = lua.globals();
|
|
lua.load(
|
|
r#"
|
|
function id(a)
|
|
return a
|
|
end
|
|
"#,
|
|
)
|
|
.exec()?;
|
|
|
|
let res = globals
|
|
.get::<Function>("id")?
|
|
.call::<LightUserData>(LightUserData(42 as *mut c_void))?;
|
|
|
|
assert_eq!(res, LightUserData(42 as *mut c_void));
|
|
|
|
Ok(())
|
|
}
|