mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 06:21:50 +00:00
remove core.quit add 'silent' argument to app.quit
This commit is contained in:
parent
24f867dbac
commit
9af675611f
4 changed files with 20 additions and 17 deletions
|
|
@ -3,5 +3,5 @@
|
||||||
<button onclick='menu.page="scripts"'>@Scripts</button>
|
<button onclick='menu.page="scripts"'>@Scripts</button>
|
||||||
<button onclick='menu.page="settings"'>@Settings</button>
|
<button onclick='menu.page="settings"'>@Settings</button>
|
||||||
<button onclick='menu.page="content_menu"'>@Content</button>
|
<button onclick='menu.page="content_menu"'>@Content</button>
|
||||||
<button onclick='core.quit()'>@Quit</button>
|
<button onclick='app.quit(true)'>@Quit</button>
|
||||||
</panel>
|
</panel>
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ local function complete_app_lib(app)
|
||||||
local __core_reconfig_packs = core.reconfig_packs
|
local __core_reconfig_packs = core.reconfig_packs
|
||||||
local __app_tick = coroutine.yield
|
local __app_tick = coroutine.yield
|
||||||
local __app_set_setting = app.set_setting
|
local __app_set_setting = app.set_setting
|
||||||
|
local __app_quit = app.quit
|
||||||
core.load_content = nil
|
core.load_content = nil
|
||||||
core.reset_content = nil
|
core.reset_content = nil
|
||||||
|
|
||||||
|
|
@ -51,7 +52,8 @@ local function complete_app_lib(app)
|
||||||
app.tick = __app_tick
|
app.tick = __app_tick
|
||||||
|
|
||||||
local function call_in_app_script_co(func, ...)
|
local function call_in_app_script_co(func, ...)
|
||||||
if coroutine.running() ~= __vc__app_script_coroutine then
|
local running = coroutine.running()
|
||||||
|
if not running or running ~= __vc__app_script_coroutine then
|
||||||
error("content must be reload in application script coroutine")
|
error("content must be reload in application script coroutine")
|
||||||
end
|
end
|
||||||
func(...)
|
func(...)
|
||||||
|
|
@ -88,15 +90,16 @@ local function complete_app_lib(app)
|
||||||
app.reconfig_packs(toadd, toremove)
|
app.reconfig_packs(toadd, toremove)
|
||||||
end
|
end
|
||||||
|
|
||||||
function app.quit()
|
function app.quit(silent)
|
||||||
local tb = debug.get_traceback(1)
|
if not silent then
|
||||||
local s = "app.quit() traceback:"
|
local tb = debug.get_traceback(1)
|
||||||
for i, frame in ipairs(tb) do
|
local s = "app.quit() traceback:"
|
||||||
s = s .. "\n\t"..tb_frame_tostring(frame)
|
for i, frame in ipairs(tb) do
|
||||||
|
s = s .. "\n\t"..tb_frame_tostring(frame)
|
||||||
|
end
|
||||||
|
debug.log(s)
|
||||||
end
|
end
|
||||||
debug.log(s)
|
__app_quit()
|
||||||
core.quit()
|
|
||||||
coroutine.yield()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function app.sleep_until(predicate, max_ticks, max_time)
|
function app.sleep_until(predicate, max_ticks, max_time)
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,12 @@ static int l_open_url(lua::State* L) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Quit the game
|
||||||
|
static int l_quit(lua::State*) {
|
||||||
|
engine->quit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const luaL_Reg applib[] = {
|
const luaL_Reg applib[] = {
|
||||||
{"get_version", lua::wrap<l_get_version>},
|
{"get_version", lua::wrap<l_get_version>},
|
||||||
{"is_content_loaded", lua::wrap<l_is_content_loaded>},
|
{"is_content_loaded", lua::wrap<l_is_content_loaded>},
|
||||||
|
|
@ -224,6 +230,7 @@ const luaL_Reg applib[] = {
|
||||||
{"set_setting", lua::wrap<l_set_setting>},
|
{"set_setting", lua::wrap<l_set_setting>},
|
||||||
{"str_setting", lua::wrap<l_str_setting>},
|
{"str_setting", lua::wrap<l_str_setting>},
|
||||||
{"get_setting_info", lua::wrap<l_get_setting_info>},
|
{"get_setting_info", lua::wrap<l_get_setting_info>},
|
||||||
|
{"quit", lua::wrap<l_quit>},
|
||||||
// for other functions see libcore.cpp and stdlib.lua
|
// for other functions see libcore.cpp and stdlib.lua
|
||||||
{nullptr, nullptr}
|
{nullptr, nullptr}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -157,12 +157,6 @@ static int l_reconfig_packs(lua::State* L) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Quit the game
|
|
||||||
static int l_quit(lua::State*) {
|
|
||||||
engine->quit();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int l_blank(lua::State*) {
|
static int l_blank(lua::State*) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -205,7 +199,6 @@ const luaL_Reg corelib[] = {
|
||||||
{"close_world", lua::wrap<l_close_world>},
|
{"close_world", lua::wrap<l_close_world>},
|
||||||
{"delete_world", lua::wrap<l_delete_world>},
|
{"delete_world", lua::wrap<l_delete_world>},
|
||||||
{"reconfig_packs", lua::wrap<l_reconfig_packs>},
|
{"reconfig_packs", lua::wrap<l_reconfig_packs>},
|
||||||
{"quit", lua::wrap<l_quit>},
|
|
||||||
{"capture_output", lua::wrap<l_capture_output>},
|
{"capture_output", lua::wrap<l_capture_output>},
|
||||||
{nullptr, nullptr}
|
{nullptr, nullptr}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue