plugins.xkcd2: Use table.maxn as there may be holes in the list

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

author
Kim Alvefur <zash@zash.se>
date
Thu, 09 Jul 2015 14:38:47 +0200
changeset 123
ce671935f504
parent 122
f3a458479f9c
child 124
4530954f545a

plugins.xkcd2: Use table.maxn as there may be holes in the list

plugins/xkcd2.lua file | annotate | diff | comparison | revisions
--- a/plugins/xkcd2.lua	Thu Jul 09 14:38:17 2015 +0200
+++ b/plugins/xkcd2.lua	Thu Jul 09 14:38:47 2015 +0200
@@ -21,7 +21,7 @@
 			if t ~= '"' then
 				num = tonumber(num);
 				if num and num < 0 then
-					num = #strip + num;
+					num = table.maxn(strips) + num;
 				end
 			end
 			strip = strips[num or q:lower()];

mercurial