Thanks Taco,
your solution helped me ... Based on initial tests, it seems that it works correctly. I'll know more after thorough testing.
Once again, thank you many times.
Sincerely Jaroslav Hajtmar


Dne 8. 7. 2015 v 12:07 Taco Hoekwater napsal(a):
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
___________________________________________________________________________________

Reply via email to