Hi all,

After Hans showed me an example of using Lua code in ConTeXt, I am learning 
this stuff in the manual cld-mkiv.pdf, which is in 

From that manual I understand that if a macro command \mycommand is defined so 
that it takes one argument, such as in
then in a Lua code one may use it as in

However, if \mycommand takes two arguments (or more), it is not clear to me how 
these arguments can be passed from Lua to Context. 
Indeed there is always the possibility to say (for a macro taking two arguments)


as in the example below with \goto. But I don’t know how to use context.goto…
The reason for which I need such a construction is that I want to add some 
links and buttons in my document which point to locations which are determined 
inside the Lua code.

Does any one have an idea to do this?
Thanks in advance and best regards: OK

%% begin test-lua-reference.tex



% a simple way of adding a link to some part of the document...
Read the following and also what \goto{Ward says}[ch:ward].\index{Ward}
See also the \goto{Index}[ref:index].

\input knuth.tex



% a complicated way of doing the same as above...
        context("Read the following and also what ") 
        context("\\goto{Knuth says}[ch:knuth]") context.index("Knuth")
        context(". See also the ")
        local s,t = "Index","ref:index"
--      context("\\goto{s}[t]") -- this does not work
--      context.goto({"Index"},{"ref:index"}) -- this does not work

\input ward.tex



% one could say \pagereference[ref:index], but I need a construction such as 
        local s,t = "ref:","index"

%% end test-lua-reference.tex
If your question is of interest to others as well, please add an entry to the 

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net

Reply via email to