plugins/xkcd2.lua

changeset 122
f3a458479f9c
parent 115
6498ca5ed831
child 123
ce671935f504
equal deleted inserted replaced
121:d68a4ae37f4a 122:f3a458479f9c
15 local url = current_url; 15 local url = current_url;
16 local q = command.param; 16 local q = command.param;
17 local strip; 17 local strip;
18 18
19 if q then 19 if q then
20 local t, num = q:match("^([#\"]?)(%d+)\"?$"); 20 local t, num = q:match("^([#\"]?)(%-?%d+)\"?$");
21 if t ~= '"' then 21 if t ~= '"' then
22 num = tonumber(num); 22 num = tonumber(num);
23 if num and num < 0 then 23 if num and num < 0 then
24 num = #strip + num; 24 num = #strip + num;
25 end 25 end

mercurial