Skip to content

Commit 89ee1ec

Browse files
committed
feat: call init and shutdown
1 parent a7ac845 commit 89ee1ec

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

examples/testbed/main.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
function loom.tick() end
1+
function loom.init()
2+
loom.log.info("Initialized lua")
3+
end
4+
5+
function loom.tick()
6+
loom.debugger()
7+
end
28

39
function loom.frame(dt) end
10+
11+
function loom.shutdown() end

src/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ use std::{fs::File, path::Path};
1010
fn main() -> LuaResult<()> {
1111
let lua = init();
1212
lua.load(Path::new("main.lua")).exec()?;
13+
14+
match lua.load("loom.init()").exec() {
15+
Ok(()) => (),
16+
Err(_) => (),
17+
};
18+
1319
game_loop(
1420
&60.0,
1521
|| match lua.load("loom.tick()").exec() {
@@ -21,6 +27,12 @@ fn main() -> LuaResult<()> {
2127
Err(_) => (),
2228
},
2329
);
30+
31+
match lua.load("loom.shutdown()").exec() {
32+
Ok(()) => (),
33+
Err(_) => (),
34+
};
35+
2436
Ok(())
2537
}
2638

0 commit comments

Comments
 (0)