diff options
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/core/luaopen_core.cpp | 11 | ||||
-rw-r--r-- | src/script/embed/boot.lua.h | 4 | ||||
-rw-r--r-- | src/script/graphics/luaopen_graphics.cpp | 9 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/script/core/luaopen_core.cpp b/src/script/core/luaopen_core.cpp index 0d76ada..a222013 100644 --- a/src/script/core/luaopen_core.cpp +++ b/src/script/core/luaopen_core.cpp @@ -11,7 +11,7 @@ namespace lua { bool running = Game::get()->running(); luax_pushboolean(L, running); - return 1; + return 1; } static int l_quit(lua_State* L) @@ -19,10 +19,17 @@ namespace lua Game::get()->quit(); return 0; } + + static int l_exit(lua_State* L) + { + Game::get()->exit(); + return 0; + } static const luaL_Reg f[] = { {"running", l_running}, - {"quit", l_quit}, + {"quit", l_quit}, // for end game loop + {"exit", l_exit}, // for exit whole game {0, 0} }; diff --git a/src/script/embed/boot.lua.h b/src/script/embed/boot.lua.h index cb61468..21c1899 100644 --- a/src/script/embed/boot.lua.h +++ b/src/script/embed/boot.lua.h @@ -145,6 +145,10 @@ local function main() end jin.core.run() end + -- quit subsystems + jin.graphics.destroy() + -- exit whole game + jin.core.exit() end main() diff --git a/src/script/graphics/luaopen_graphics.cpp b/src/script/graphics/luaopen_graphics.cpp index 948e28a..40bdaa1 100644 --- a/src/script/graphics/luaopen_graphics.cpp +++ b/src/script/graphics/luaopen_graphics.cpp @@ -38,6 +38,13 @@ namespace lua luax_pushboolean(L, wnd->init(&setting)); return 1; } + + static int l_destroy(lua_State* L) + { + Window* wnd = Window::get(); + wnd->quit(); + return 0; + } /** * Get windows size. @@ -488,6 +495,8 @@ namespace lua {"circle", l_drawCircle}, {"triangle", l_drawTriangle}, {"polygon", l_drawPolygon}, + // + {"destroy", l_destroy}, {0, 0} }; |