![](https://secure.gravatar.com/avatar/62c54476729274ddfefd6b1f53e311dc.jpg?s=120&d=mm&r=g)
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....)