plugins.xkcd: If no argument is given, return the latest strip

Mon, 11 Feb 2013 18:28:28 +0100

author
Kim Alvefur <zash@zash.se>
date
Mon, 11 Feb 2013 18:28:28 +0100
changeset 97
a532667d596e
parent 96
c2c30f94e619
child 98
1f365028aae1

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)

mercurial