From: Hans Hagen <j.hagen@xs4all.nl>
To: ntg-context@ntg.nl
Subject: Re: string.format changed in LuaTeX / grph-downsample
Date: Fri, 23 Mar 2018 10:44:43 +0100 [thread overview]
Message-ID: <d8b3daf9-682a-2d95-8846-ed71d589460a@xs4all.nl> (raw)
In-Reply-To: <F9A07911-118E-44D2-A64C-F8244DE48A98@fiee.net>
On 3/23/2018 9:46 AM, Henning Hraban Ramm wrote:
> Ahoi, since i recently updated my ConTeXt beta, Lua function string.format behaves differently, i.e. type checks are stricter.
> I guess it’s due to switching to Lua 5.3 in LuaTeX?
This is indeed one of the changes in 5.3 (more about that at the ctx
meeting).
Anyway, format is a bit unstable over time anyway, which is why in
context we have string.formatters with some more options (cld manual):
print(string.formatter("%r",1))
print(string.formatter("%r",1.1))
print(string.formatter("%p",1))
print(string.formatter("%p",1.1))
etc. On the average its also faster than string.format. It means that we
could make the transition to 5.3 without too much hassle (very little
had to be adapted and luigi and i are running context with 5.3 for quite
a while now).
> E.g. this:
>
> if tonumber(string.format('%d', value)) == value then ...
>
> throws
>
> bad argument #2 to 'format' (number has no integer representation)
>
> Since I just need to check if the number is integer, this works:
>
> if tonumber(value) == math.floor(value) then ...
>
>
> This also affects Peter Münster’s grph-downsample module; please find a fixed version attached.
> (Decimal pixel sizes make no sense anyway, so I just "floored" them.)
better round them
> Greetlings, Hraban
> ---
> http://www.fiee.net
> http://wiki.contextgarden.net
> GPG Key ID 1C9B22FD
>
>
>
> ___________________________________________________________________________________
> 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
___________________________________________________________________________________
prev parent reply other threads:[~2018-03-23 9:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-23 8:46 Henning Hraban Ramm
2018-03-23 9:44 ` Hans Hagen [this message]
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=d8b3daf9-682a-2d95-8846-ed71d589460a@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=ntg-context@ntg.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).