mudgangster

Log | Files | Refs

commit c9f88503ac92b927eb04430f6ea213e6bef9809b
parent bbb763dccbdbc0f5dc22b03b03ad4363e36e0905
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Fri,  7 Sep 2018 15:18:45 +0300

Use xpcall in intercept/action stack traces, don't use % in mud.print

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

diff --git a/src/lua/action.lua b/src/lua/action.lua @@ -56,10 +56,10 @@ local function genericActions( actions ) local action = actions[ i ] if action.enabled then - local ok, err = pcall( string.gsub, line, action.pattern, action.callback ) + local ok, err = xpcall( string.gsub, debug.traceback, line, action.pattern, action.callback ) if not ok then - mud.print( debug.traceback( "\n#s> action callback failed: %s" % err ) ) + mud.print( "\n#s> action callback failed: %s", err ) end end end diff --git a/src/lua/alias.lua b/src/lua/alias.lua @@ -12,7 +12,7 @@ local function doAlias( line ) local ok, err, subs = xpcall( string.gsub, debug.traceback, args, callback.pattern, callback.callback ) if not ok then - mud.print( "\n#s> alias callback failed: %s" % err ) + mud.print( "\n#s> alias callback failed: %s", err ) return true end @@ -25,7 +25,7 @@ local function doAlias( line ) end if badSyntax then - mud.print( "\nsyntax: %s %s" % { command, alias.syntax } ) + mud.print( "\nsyntax: %s %s", command, alias.syntax ) end return true diff --git a/src/lua/intercept.lua b/src/lua/intercept.lua @@ -5,10 +5,10 @@ local function doIntercept( command ) local intercept = Intercepts[ i ] if intercept.enabled then - local ok, err = pcall( string.gsub, command, intercept.pattern, intercept.callback ) + local ok, err = xpcall( string.gsub, debug.traceback, command, intercept.pattern, intercept.callback ) if not ok then - mud.print( debug.traceback( "\n#s> intercept callback failed: %s" % err ) ) + mud.print( "\n#s> intercept callback failed: %s", err ) end end end diff --git a/src/lua/interval.lua b/src/lua/interval.lua @@ -9,7 +9,7 @@ local function doIntervals() if event.enabled then local ok, err = xpcall( event.checkTick, debug.traceback, event, now ) if not ok then - mud.print( "\n#s> interval callback failed: %s" % err ) + mud.print( "\n#s> interval callback failed: %s", err ) end end end diff --git a/src/lua/macro.lua b/src/lua/macro.lua @@ -6,7 +6,7 @@ local function doMacro( key ) if macro then local ok, err = xpcall( macro, debug.traceback ) if not ok then - mud.print( "\n#s> macro callback failed: %s" % err ) + mud.print( "\n#s> macro callback failed: %s", err ) end end end