On 9/6/2021 6:20 PM, Henning Hraban Ramm via ntg-context wrote:
Another question:
I think I understood the need for function arguments.
My macro, defined with interfaces.implement, works while I call "Image" below,
but if I call "ClippedImage" (one level of indirection more), I get:
"""
tex error > tex error on line 28 in file virtual://page.nopage.1: Missing
{ inserted
...(no helpful output here)...
A left brace was mandatory here, so I've put one in.
"""
I can’t imagine where to put that brace.
function Image(Width, Height, filename)
context.externalfigure(
{ filename },
{
width = todimen(Width),
}
)
end
function ClippedImage(Width, Height, filename)
context.clip(
{
width = todimen(Width),
height = todimen(Height),
},
Image(Width, Height, filename)
function() Image(Width, Height, filename) end
)
end
Am 05.09.2021 um 16:27 schrieb Henning Hraban Ramm via ntg-context
<ntg-context@ntg.nl>:
TeX:
\def\Something{1cm}
Lua:
context.Something()
yes (assuming you're in scope)
Then I’m out of scope.
\def is in my environment, directly before I load the Lua functions with
\loadluafile.
How can I access the macros from the environment there?
2) The original interface of \MyFun had two optional parameters. I couldn’t
find how to do that with interfaces.implement.
cld-mkiv, p.151 (12.7) shows how to do lists or key=value, but not single
optional args.
there is "optional"
and ... cld is not yet updated to lmtx in this respect so some newer features
are missing
Must I then declare "string optional" etc.?
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________