Files
mlua-rs-mlua/tests/types.rs
T
Alex Orlenko 3641c98959 Prepare for Rust 2024 edition (see rust-lang/rust#123748)
Replace `IntoLua(Multi)` generic with positional arg (impl trait) where possible
This allow to shorten syntax from `a.get::<_, T>` to `a.get::<T>`
2024-07-31 23:42:43 +01:00

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(())
}