commit 72b0096e18c59c75bd77872cfe20e5b23fd06a5b
parent ed4fa12c0dc5d0ea41584bf4ee83c3b0d32651bd
Author: Michael Savage <mikejsavage@gmail.com>
Date: Thu, 6 Dec 2012 00:52:33 +0000
Add error checking to alias callbacks
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/alias.lua b/alias.lua
@@ -9,7 +9,13 @@ local function doAlias( line )
for i = 1, #alias.callbacks do
local callback = alias.callbacks[ i ]
- local _, subs = args:gsub( callback.pattern, callback.callback )
+ local ok, err, subs = pcall( string.gsub, args, callback.pattern, callback.callback )
+
+ if not ok then
+ mud.print( debug.traceback( "\n#s> alias callback failed: %s" % err ) )
+
+ return true
+ end
if subs ~= 0 then
badSyntax = false