Skip to main content

test/
test.rs

1// This "example" is used internally by me for testing whenever developing new features, so it's not a real example...
2
3#![cfg(not(doc))]
4
5use low_luajit::{AmountReturned, LuaState};
6
7extern "C-unwind" fn test(mut lua: LuaState) -> AmountReturned {
8	/*lua.push_number(12.3);
9	lua.push_number(12.3);
10	//lua.yield_any(123123)
11	lua.get_global(c"math");
12	println!("{}", lua.display(-1));
13	unsafe { low_luajit::ffi::luaopen_math(lua.as_ptr()); }
14	lua.get_global(c"math");
15	println!("{}", lua.display(-1));
16	lua.pop(1);
17	lua.return_any(1)*/
18
19	let foo = lua.find_table(LuaState::GLOBALS_INDEX, c"gmatch", 0);
20	lua.push_nil();
21	lua.pop(1);
22	let _ = dbg!(foo, lua.get_top());
23
24	lua.new_table();
25	lua.set_metatable(-12312321);
26
27	lua.return_none()
28}
29
30#[unsafe(no_mangle)]
31extern "C-unwind" fn luaopen_test(lua: LuaState) -> AmountReturned {
32	lua.return_cfunction(test)
33}