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