Taco Hoekwater wrote:
> 
> Bart C. Wise wrote:
>> Hans,
>>
>> What's the chances on getting this fixed?  
> 
> This is the bug:
> 
> --- syst-lua.lua.orig   2008-11-27 10:39:58.396303891 +0100
> +++ syst-lua.lua        2008-11-27 10:40:02.063303374 +0100
> @@ -46,8 +46,8 @@
>  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
> +    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[i] then
                               ^
                         also wrong

sorry for not testing this better


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



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to