diff options
Diffstat (limited to 'src/lua/embed/boot.lua')
-rw-r--r-- | src/lua/embed/boot.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lua/embed/boot.lua b/src/lua/embed/boot.lua index 6869ac8..e649737 100644 --- a/src/lua/embed/boot.lua +++ b/src/lua/embed/boot.lua @@ -1,4 +1,3 @@ - jin._argv[2] = jin._argv[2] or '.' jin.filesystem.init() jin.filesystem.mount(jin._argv[2]) @@ -28,13 +27,14 @@ local function safecall(func, ...) if func then func(...) end -end +end function jin.core.run() - safecall(jin.core.load) + safecall(jin.core.onLoad) local previous = jin.time.second() local SEC_PER_UPDATE = 1 / conf.fps local dt = SEC_PER_UPDATE + local running = true while(jin.core.running()) do for _, e in pairs(jin.event.poll()) do if e.type == "keydown" then @@ -43,10 +43,10 @@ function jin.core.run() jin.keyboard.set(e.key, false) end safecall(jin.core.onEvent, e) + running = jin.core.running() + if not running then break end end - if not jin.core.running() then - break - end + if not running then break end safecall(jin.core.onUpdate, dt) @@ -88,7 +88,7 @@ local function onError(msg) end end -local function main() +local function boot() if jin.filesystem.exist("main.lua") then -- require main game script xpcall(function() require"main" end, onError) @@ -115,4 +115,4 @@ local function main() jin.core.quit() end -main() +boot() |