Mon, 11 Feb 2013 18:28:28 +0100
plugins.xkcd: If no argument is given, return the latest strip
plugins/xkcd.lua | file | annotate | diff | comparison | revisions |
--- a/plugins/xkcd.lua Mon Jun 04 17:38:26 2012 +0200 +++ b/plugins/xkcd.lua Mon Feb 11 18:28:28 2013 +0100 @@ -34,7 +34,9 @@ function handle_xkcd_command(command) local xkcdnum = command.param; - if not xkcdnum then return "Please supply an XKCD number or a search string :)"; end + if not xkcdnum then + xkcdnum = #xkcd_list; + end if not tonumber(xkcdnum) then -- Search for an xkcd xkcdnum = xkcdnum:lower() local xkcdpat = xkcdnum:gsub("[()]", function(s) return "%" .. s end)