From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: cld questions
Date: Mon, 6 Sep 2021 20:00:49 +0200 [thread overview]
Message-ID: <ab147719-372b-8929-db37-d19eed5ab654@xs4all.nl> (raw)
In-Reply-To: <FE1F9199-427A-42C4-A10B-DB220176854F@fiee.net>
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
___________________________________________________________________________________
next prev parent reply other threads:[~2021-09-06 18:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-05 10:01 Henning Hraban Ramm via ntg-context
2021-09-05 11:01 ` Hans Hagen via ntg-context
2021-09-05 14:27 ` Henning Hraban Ramm via ntg-context
2021-09-06 16:20 ` Henning Hraban Ramm via ntg-context
2021-09-06 18:00 ` Hans Hagen via ntg-context [this message]
2021-09-06 19:16 ` Henning Hraban Ramm via ntg-context
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab147719-372b-8929-db37-d19eed5ab654@xs4all.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@xs4all.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).