From becd1d11aeae3831ece7a84e26b3ec346d94bad1 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 5 Feb 2024 07:02:50 +0300 Subject: [PATCH] load_script error handling fix --- res/scripts/stdlib.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/res/scripts/stdlib.lua b/res/scripts/stdlib.lua index 66f1885f..40bc500a 100644 --- a/res/scripts/stdlib.lua +++ b/res/scripts/stdlib.lua @@ -37,10 +37,14 @@ function load_script(path, nocache) if not nocache and __cached_scripts[fullpath] ~= nil then return __cached_results[fullpath] end - local script = loadfile(fullpath) - if script == nil then + if not file.isfile(fullpath) then error("script '"..filename.."' not found in '"..packname.."'") end + + local script, err = loadfile(fullpath) + if script == nil then + error(err) + end local result = script() if not nocache then __cached_scripts[fullpath] = script