lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Feb 10, 2016 8:46 AM, "Daniel Silverstone" <dsilvers@digital-scurf.org> wrote:
>
> On Wed, Feb 10, 2016 at 17:26:24 +0100, Marc Balmer wrote:
> > We switched from Lua 5.2 to Lua 5.3 and suddenly a seemingly small change in Lua's number formatting is hitting us really hard:
> >
> > Before 5.2, a number value of 41.0 would produce a string of '41'.  After 5.3, it produces '41.0':
>
> Time to start using string.format("%u", ...) ?
>
> D.
>
> --
> Daniel Silverstone                         http://www.digital-scurf.org/
> PGP mail accepted and encouraged.            Key Id: 3CCE BABE 206C 3B69
>

That only works if you know the value is an integer. If it's not, then you're losing data. There operation you want is probably more like s/\.0$// than %u.

/s/ Adam