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

Patrick Gundlach patrick at gundla.ch
Wed Dec 17 16:29:17 CET 2014


> 
> 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)


you're right: this is most likely due to the underlying libc...

from the linux sprintf(3) manpage:

       0      The value should be zero padded.  For d, i, o, u, x, X, a, A, e,
              E, f, F, g, and G conversions, the converted value is padded  on
              the  left  with  zeros rather than blanks.  If the 0 and - flags
              both appear, the 0 flag is ignored.  If  a  precision  is  given
              with  a numeric conversion (d, i, o, u, x, and X), the 0 flag is
              ignored.  For other conversions, the behavior is undefined.

and from the mac:

         `0' (zero)   Zero padding.  For all conversions except n, the converted
                      value is padded on the left with zeros rather than blanks.
                      If a precision is given with a numeric conversion (d, i, o,
                      u, i, x, and X), the 0 flag is ignored.


Thanks!

   Patrick

(who enjoys writing portable Go programs more and more....)




More information about the dev-luatex mailing list