Thanx Wolfgang.
It is a good example, which I will definitely come in handy sometimes,
but unfortunately I can not help my problem to solve.
Once again, many thanks
Jaroslav
Dne 17.7.2011 15:40, Wolfgang Schuster napsal(a):
You can’t expand macro from Lua but the following is possible:
\startluacode
values = {
I = "1",
II = "2",
}
function test(arg)
if string.find(arg,"\\macro") then
arg = string.gsub(arg,"\\macro","")
if values[arg] then
context(values[arg])
else
context("Invalid index.")
end
else
context("Invalid command.")
end
end
\stopluacode
\starttext
\starttabulate
\NC \type{\macroI} \EQ \ctxlua{test("\\macroI")} \NC\NR
\NC \type{\macroII} \EQ \ctxlua{test("\\macroII")} \NC\NR
\NC \type{\macroIII} \EQ \ctxlua{test("\\macroIII")} \NC\NR
\NC \type{\foo} \EQ \ctxlua{test("\\foo")} \NC\NR
\stoptabulate
\stoptext
Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________