From a94f949be6029c707bcd47a6a59bf02119619b35 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Thu, 21 Mar 2024 01:16:33 +0300 Subject: [PATCH] lua: core.quit() --- src/logic/scripting/lua/libcore.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/logic/scripting/lua/libcore.cpp b/src/logic/scripting/lua/libcore.cpp index ae550e38..e9d33662 100644 --- a/src/logic/scripting/lua/libcore.cpp +++ b/src/logic/scripting/lua/libcore.cpp @@ -4,6 +4,7 @@ #include "../../../engine.h" #include "../../../files/engine_paths.h" #include "../../../frontend/menu/menu.h" +#include "../../../window/Window.h" #include "../scripting.h" #include @@ -27,8 +28,14 @@ static int l_open_world(lua_State* L) { return 0; } +static int l_quit(lua_State* L) { + Window::setShouldClose(true); + return 0; +} + const luaL_Reg corelib [] = { {"get_worlds_list", lua_wrap_errors}, {"open_world", lua_wrap_errors}, + {"quit", lua_wrap_errors}, {NULL, NULL} };