[Dev-luatex] lua(jit)tex / string.format differs

Hans Hagen pragma at wxs.nl
Wed Dec 17 16:21:47 CET 2014


On 12/17/2014 3:55 PM, Patrick Gundlach wrote:
> Hi all,
>
>
> $ cat foo.lua
> print( string.format("%08s","1100101"))
>
> (so a one liner, nothing fancy).
>
> On my Mac:
>
> $ luatex foo.lua
> 01100101
>
>
> on my Linux machine:
>
> $ luatex foo.lua
>   1100101
>
> (where is the leading 0??)
>
>
> Mac: $ luatex --version
> This is LuaTeX, Version beta-0.79.1 (TeX Live 2014) (rev 4971)
>
> Linux: $ luatex --version
> This is LuajitTeX, Version beta-0.79.1 (TeX Live 2014/dev) (rev 4972)
>
> How can this difference show up? Is this something from "jit"?

on windows i get no leading 0 ... I think %s has no 'leading whatever' 
spec, only a - for justification so I guess that interpreting the number 
is library specific (apart from the fact that lua has some wrapper code 
around format and jit probably overloads some)

just for fun i tried

\ctxlua{print(string.format("%a8i",1100101))}

which on linux gives

    invalid option '%a' to 'format'

and on windows

    0x1.0c9450p+208i

whatever that means

so one has to be real careful with what goes in front of a length specifier

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the dev-luatex mailing list