On 03/18/2014 07:55 PM, Hans Hagen wrote:
On 3/18/2014 6:58 PM, Pablo Rodriguez wrote:
\def\CheckUser{\cldcommand{sprint(tex.vrbcatcodes,os.resultof"whoami")}} \def\UserNumber{\processaction[\CheckUser][ousia=>1, unknown=>user unknown]}
\starttext This is user \CheckUser\ with number \UserNumber. \stoptext
What am I doing wrong here?
you output vrbcatcodes strings while you test using ctx catcodesn
of course i'd use lua for all of it:
\startluacode local user = "" local users = { ["oasi"] = 1, } function document.CheckUser() user = os.resultof("whoami") context.verbatim(user) end
function document.UserNumber(name) context.verbatim(users[name or user] or 0) end \stopluacode
\def\CheckUser {\ctxlua{document.CheckUser ()}} \def\UserNumber{\ctxlua{document.UserNumber()}}
\starttext This is user \CheckUser\ with number \UserNumber. \stoptext
Many thanks for your reply, Hans. I’m afraid that the user doesn’t get recognized (I corrected the user name above). Is there no way to do it with \processaction? Many thanks for your help, Pablo -- http://www.ousia.tk