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. I tried it using commands context.setgvalue, or find something
on the wiki
(http://wiki.contextgarden.net/System_Macros/Definitions_and_Assignments),
but each time I broke a tooth on it.
Can you, please, someone advise how something can be it done? Suffice
some reference to solve a similar problem.
Thanks Jaroslav Hajtmar
Here is my minimal example:
\starttext
\def\lastname{\dosingleempty\dolastname}
\def\dolastname[#1]{\iffirstargument #1\else nothing\fi}
\lastname
\lastname[Smith]
% Not working
% \ctxlua{
% context([[\def\firstname{\dosingleempty\dofirstname}]])
% context([[\def\dofirstname[#1]{\iffirstargument #1\else {nothing}\fi}]])
% }
%
% \firstname
%
% \firstname['Peter']
\stoptext
___________________________________________________________________________________
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
___________________________________________________________________________________