Re: Integers-related trap in Lua 5.3
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Integers-related trap in Lua 5.3
- From: Dirk Laurie <dirk.laurie@...>
- Date: 2016年5月16日 15:43:05 +0200
2016年05月16日 14:47 GMT+02:00 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>> > IMO, both Lua parser and tonumber() function should return correct
>> > float values in case of integer overflow.
>> > This can be done safely as it does not break the main feature of integers:
>> > integers will stay integers after tonumber(tostring(x)) conversion cycle.
>>
>>
>> Or nil.
>
> Some time ago I suggested 'inf' for these cases.
That would also be good. The test
math.type(tonumber(inputstring)) == 'integer'
could be used to verify input.