[NTG-context] integer displayed as .0 float in Lua-5.3

Pablo Rodriguez oinos at gmx.es
Sat Aug 11 12:05:39 CEST 2018


On 08/09/2018 10:25 PM, Hans Hagen wrote:
> In addition to what others already explained, you should not depend on 
> features that are implementation dependent or might disappear.

Many thanks for your detailed explanation, Hans.

I had no idea that the automatic conversion from string to number where
so dependent on the Lua version.

> That said 
> ...
> 
> \startTEXpage[offset=1em]
> \ctxlua{context([[\lastpage]])}.
> \stopTEXpage
> 
> Why do you convert \lastpage to a string using [[\lastpage]] which will 
> use the string to number conversion?

Well, I must confess that this is a new knowledge to me.

I thought that "[[ ]]" was the form to escape what I think it is the
escape character in Lua.

How I came to that assumption? Probably because I tried to add a raw
command to \ctxlua or inside a \startlua...\stoplua.

> You can just do:
> 
> \startTEXpage[offset=1em]
> \ctxlua{context(\lastpage + 1)}.
> \stopTEXpage

>From this sample, I understand that "\" doesn’t need to be escaped
inside context(), does it?

> or if you really want to [[ ]]
> 
> \startTEXpage[offset=1em]
> \the\numexpr\ctxlua{context([[lastpage]] + 1)}\relax .
> \stopTEXpage
> 
> endless possibities here.

I don’t need "[[ ]]", I only thought I needed them.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk


More information about the ntg-context mailing list