The following worked without a hitch:

\def\IsNilReturn#1{\edef\tmp{#1}\doifelse{\tmp}{nil}{\color[red]{ERROR}}{\tmp}}
\def\formatDuration#1{\ctxlua{
        local s = string.gsub("#1","\%D","")
        local d = tostring(hvdm.time:match(s))
        tex.print(string.sub(d,1,2) ~= "0:" and d or string.sub(d,3))
        }}
\def\FormatDuration#1{\IsNilReturn{\formatDuration{#1}}}
Called by something like \FormatDuration{11929} (meaning: 1 hour 19 minutes 29 
seconds)

Now I get an error in
ConTeXt  ver: 2013.01.27 21:24 MKIV  fmt: 2013.1.28  int: english/english
! LuaTeX error [string "\directlua "]:1: invalid escape sequence near '\%'.
\formatDuration ...0:" and d or string.sub(d,3)) }                              
               
\IsNilReturn #1->\edef \tmp {#1
                               }\doifelse {\tmp }{nil}{\color [red]{ERROR}}{...

Whereas in a previous Context all went well:
ConTeXt  ver: 2012.05.30 11:26 MKIV  fmt: 2013.2.4  int: english/english

What did change? Why? And how to repair?

Hans van der Meer



___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to