mudgangster

Log | Files | Refs

commit 25fb245d4f0e427e6261ced299ffde09de86796b
parent 9ad2f84f81b81e47bbcca3ee63ae50f536d827e5
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Fri,  7 Sep 2018 10:34:06 +0300

pcall macro/interval callbacks too

Diffstat:
src/lua/interval.lua | 5++++-
src/lua/macro.lua | 5++++-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/lua/interval.lua b/src/lua/interval.lua @@ -7,7 +7,10 @@ local function doIntervals() local event = Intervals[ i ] if event.enabled then - event:checkTick( now ) + local ok, err = xpcall( event.checkTick, debug.traceback, event, now ) + if not ok then + mud.print( "\n#s> interval callback failed: %s" % err ) + end end end end diff --git a/src/lua/macro.lua b/src/lua/macro.lua @@ -4,7 +4,10 @@ local function doMacro( key ) local macro = Macros[ key ] if macro then - macro() + local ok, err = xpcall( macro, debug.traceback ) + if not ok then + mud.print( "\n#s> macro callback failed: %s" % err ) + end end end