2011/3/24 Wolfgang Schuster
Am 24.03.2011 um 17:29 schrieb Cecil Westerhof:
\def\getdate% {\dosinglegroupempty\dogetdate}
\def\dogetdate#1% {context{modification_date("\jobname.tex", "#1")}}
\def\getdate {\dosingleempty\dogetdate}
\def\dogetdate[#1]% {\ctalua{context(modification_date("\jobname.tex", "#1"))}}
I have: \startluacode function modification_date(file, format) local f = file local attr = lfs.attributes(f) assert (type(attr) == "table") if attr.mode ~= "directory" then if format == "long" then return os.date("%Y-%m-%d %H:%M",attr.modification) else return os.date("%Y-%m-%d",attr.modification) end end end \stopluacode \def\getdate {\dosingleempty\dogetdate} \def\dogetdate[#1]% {\ctalua{context(modification_date("\jobname.tex", "#1"))}} \starttext \getdate \stoptext This gives: \dogetdate [#1]->\ctalua {context(modification_date("\jobname .tex", "#1"))} l.29 \getdate[] ? I tried with \getdate, \getdate{} and \getdate[]. -- Cecil Westerhof