Hans, I tried the changes, but now footnotes do not appear at all! Here's a copy of the code that I used (combining both Hans' and Taco's changes -- although I tried several variants). local s = lpeg.Ct(lpeg.splitat(",")) local h = { } function commands.doifcommonelse(a,b) local ha = h[a] local hb = h[b] if not ha then ha = {s:match(a)} h[a] = ha end if not hb then hb = {s:match(b)} h[b] = hb end for i=1,#ha do for j=1,#hb do if ha[i] == hb[j] then return cs.testcase(true) end end end return cs.testcase(false) end function commands.doifinsetelse(a,b) local hb = h[b] if not hb then hb = {s:match(b)} h[b] = hb end for i=1,#hb do if a == hb[i] then return cs.testcase(true) end end return cs.testcase(false) end Ideas? Thanks, Bart On Thursday 27 November 2008 03:17, Hans Hagen wrote:
local s = lpeg.Ct(lpeg.splitat(",")) local h = { }
function commands.doifcommonelse(a,b) local ha = h[a] local hb = h[b] if not ha then ha = s:match(a) h[a] = ha end if not hb then hb = s:match(b) h[b] = hb end for i=1,#ha do for j=1,#hb do if ha[i] == hb[j] then return cs.testcase(true) end end end return cs.testcase(false) end
function commands.doifinsetelse(a,b) local hb = h[b] if not hb then hb = s:match(b) h[b] = hb end for i=1,#hb do if a == hb[i] then return cs.testcase(true) end end return cs.testcase(false) end