From 0ffefddee1781389fc6e8014ea00856e09cfff1d Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 1 Jun 2026 01:08:24 +0300 Subject: [PATCH] fix post-runnable context in content-related functions --- res/modules/internal/lifetime_events.lua | 5 +++++ res/scripts/stdlib.lua | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/res/modules/internal/lifetime_events.lua b/res/modules/internal/lifetime_events.lua index 48a96c550..e1460c22c 100644 --- a/res/modules/internal/lifetime_events.lua +++ b/res/modules/internal/lifetime_events.lua @@ -200,6 +200,8 @@ local function __process_post_runnables() end end +local __vc__is_post_runnable = false + function __vc__process_post_runnables() __vc__is_post_runnable = true local success, err = pcall(__process_post_runnables) @@ -221,4 +223,7 @@ return { __vc_on_world_save = __vc_on_world_save, __vc_on_world_quit = __vc_on_world_quit, __vc__process_post_runnables = __vc__process_post_runnables, + __vc_is_post_runnable_context = function() + return __vc__is_post_runnable + end } diff --git a/res/scripts/stdlib.lua b/res/scripts/stdlib.lua index 702d50072..093501d75 100644 --- a/res/scripts/stdlib.lua +++ b/res/scripts/stdlib.lua @@ -26,7 +26,6 @@ local function tb_frame_tostring(frame) end local __vc__app_script_coroutine -local __vc__is_post_runnable = false local function complete_app_lib(app) local __app_load_content = app.load_content @@ -46,7 +45,7 @@ local function complete_app_lib(app) app.tick = __app_tick local function call_in_app_script_co(func, ...) - if __vc__is_post_runnable then + if __vc_is_post_runnable_context() then func(...) return end