From 4214f1eb0daf256efb4ca011f14e54603006cc94 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Fri, 2 Sep 2022 10:16:14 -0300 Subject: [PATCH] Better auto run script error handler --- functions/autorun.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/functions/autorun.lua b/functions/autorun.lua index d4e5cc37..b67c2acc 100644 --- a/functions/autorun.lua +++ b/functions/autorun.lua @@ -23,7 +23,18 @@ end --function to dispatch events function Details:DispatchAutoRunCode(codeKey) local func = Details.AutoRunCode[codeKey] - DF:QuickDispatch(func) + + if (type(func) ~= "function") then + Details:Msg("error running function for auto run script", codeKey) + return + end + + local okay, errortext = pcall(func) + + if (not okay) then + Details:Msg("error running auto run script: ", codeKey, errortext) + return + end end --auto run frame to dispatch scrtips for some events that details! doesn't handle