On 08 Jul 2015, at 13:04, Jaroslav Hajtmar
wrote: Hi Taco. full deployment is unfortunately not working.
Unfortunately I need to cycle create different macros whose names are variable. At this moment I can not deal with this:
--- context.doxlsname() --- ?????
context[‘do’..xlsname]()
Thanx Jaroslav Hajtmar
here is another minimal example:
\starttext
\def\linepointer{5}
\def\csvcell[#1,#2]{cell #1,#2}
\directlua{ xlsname='A' interfaces.definecommand ('do'..xlsname, { arguments = { { "option", "string" } }, macro = function (opt_1) if #opt_1>0 then context('\\csvcell["'..xlsname..'",'..opt_1..']') else context('\\csvcell["'..xlsname..'",\\linepointer]') end end }) interfaces.definecommand (xlsname, { macro = function () context.dosingleempty() --- context.doxlsname() --- ????? end }) }
\csvcell['Firstname',\linepointer]
\A
\A[5]
\stoptext
Dne 8. 7. 2015 v 12:07 Taco Hoekwater napsal(a):
\startluacode interfaces.definecommand ('dolastname', { arguments = { { "option", "string" } }, macro = function (opt_1) if #opt_1>0 then context(opt_1) else context('nothing') end end }) interfaces.definecommand ('lastname', { macro = function () context.dosingleempty() context.dolastname() end }) \stopluacode