[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A 5.3 change is biting us hard...
- From: Coda Highland <chighland@...>
- Date: Wed, 10 Feb 2016 09:05:09 -0800
On Wed, Feb 10, 2016 at 8:57 AM, Hisham <h@hisham.hm> wrote:
> On 10 February 2016 at 14:50, Coda Highland <chighland@gmail.com> wrote:
>>
>> 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", ...) ?
>>
>> 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.
>
> I'd venture to guess that if one is having trouble due to ".0", that
> almost certainly means they are indeed expecting an integer.
>
> -- Hisham
>
Yes and no. I mean, yes, of course that's when the problem arises, but
consider that the context is a pgsql binding: It's generic library
code. The same code path handles both integers (where the 5.3 change
is going to break things) and floats (where formatting with %u will
lose data), and the distinction happens at a layer out of the
library's control.
/s/ Adam