plugins.xkcd2: Allow negative numbers in pattern

Thu, 09 Jul 2015 14:38:17 +0200

author
Kim Alvefur <zash@zash.se>
date
Thu, 09 Jul 2015 14:38:17 +0200
changeset 122
f3a458479f9c
parent 121
d68a4ae37f4a
child 123
ce671935f504

plugins.xkcd2: Allow negative numbers in pattern

plugins/xkcd2.lua file | annotate | diff | comparison | revisions
--- a/plugins/xkcd2.lua	Thu Jul 09 14:34:36 2015 +0200
+++ b/plugins/xkcd2.lua	Thu Jul 09 14:38:17 2015 +0200
@@ -17,7 +17,7 @@
 		local strip;
 
 		if q then
-			local t, num = q:match("^([#\"]?)(%d+)\"?$");
+			local t, num = q:match("^([#\"]?)(%-?%d+)\"?$");
 			if t ~= '"' then
 				num = tonumber(num);
 				if num and num < 0 then

mercurial