18 Mar
2014
18 Mar
'14
11:30 p.m.
On Tue, 18 Mar 2014, Pablo Rodriguez wrote:
The next one (AFAIK) should work on every OS:
\startluacode local user = "" local users = { ["ousia"] = 1, } function document.CheckUser() user = os.resultof("echo ousia") 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
(Untested) Change `local user` by ~~~ userdata = userdata or {} userdata.user = "" ~~~ and all other occurances of `user` by `userdata.user`. Aditya