> On 08 Jul 2015, at 11:05, Jaroslav Hajtmar <hajt...@gyza.cz> wrote: > > Hello ConTeXist. > > Within the one very complex problem I need to solve the following case. I > want using lua code to define a macro with one optional parameter in brackets.
Simplest solution I know is this: \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 Best wishes, Taco ___________________________________________________________________________________ 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 ___________________________________________________________________________________