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
___________________________________________________________________________________
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