blob: 72f9484f40b5a733b6641f49af7ca6da453c52c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
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(())
}
|