# HG changeset patch # User Mikael Berthe # Date 1271191512 -7200 # Node ID c515e8218c873eb33ce5a085912988b98f33ac56 # Parent 7cf014d0d2063727921f8f9345259b314b4cdbac Small optimization diff -r 7cf014d0d206 -r c515e8218c87 mcbot/cmds/mcabber_bts.lua --- a/mcbot/cmds/mcabber_bts.lua Tue Apr 13 22:43:43 2010 +0200 +++ b/mcbot/cmds/mcabber_bts.lua Tue Apr 13 22:45:12 2010 +0200 @@ -18,10 +18,8 @@ local function mcabber_bts (num) -- Check that xepnum is a valid number - if num then - num = num:gsub("[%s%?%.%!]+$", "") - num = tonumber(num) - end + if num then num = num:gsub("[%s%?%.%!]+$", "") end + num = tonumber(num) if not num or num < 1 then return nil, "Please provide an issue number" end diff -r 7cf014d0d206 -r c515e8218c87 mcbot/cmds/xep.lua --- a/mcbot/cmds/xep.lua Tue Apr 13 22:43:43 2010 +0200 +++ b/mcbot/cmds/xep.lua Tue Apr 13 22:45:12 2010 +0200 @@ -33,7 +33,7 @@ -- Logics comes from MattJ's riddim bot local function lookup_xep (xepnum) - xepnum = xepnum:gsub("[%s%?%.%!]+$", "") + if (xepnum) then xepnum = xepnum:gsub("[%s%?%.%!]+$", "") end -- Check that xepnum is a valid number xepnum = tonumber(xepnum) if not xepnum or xepnum <= 0 or xepnum > 9999 then return nil, "What XEP?" end