lua-users home
lua-l archive

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


On Tue, Aug 18, 2015 at 6:11 AM, Andrew Starks <andrew.starks@trms.com> wrote:
>
>
> On Tuesday, August 18, 2015, Daurnimator <quae@daurnimator.com> wrote:
>>
>> On 18 August 2015 at 16:03, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> > 2015-08-17 21:22 GMT+02:00 Petite Abeille <petite.abeille@gmail.com>:
>> >
>> >>> On Aug 17, 2015, at 9:15 PM, Dirk Laurie <dirk.laurie@gmail.com>
>> >>> wrote:
>> >>>
>> >>> But it won't work as expected when str1 and str2 both
>> >>> are convertible to numbers.
>> >>
>> >> LUA_NOCVTN2S
>> >> LUA_NOCVTS2N
>> >
>> > Who on this list invokes "lua", their everyday Lua interpreter,
>> > and what gets executed is Lua 5.3 compiled with those two
>> > options on? Put up your hands, please.
>>
>> I have LUA_NOCVTS2N on; string to number coercion is almost always a bug.
>>
>> LUA_NOCVTN2S causes enough issues I don't have time to deal with it.
>>
>
> Same exact situation, except that I'm not sure about the bugs actually
> caught by NOCVTS2N. N2S was very difficult to deal with, especially with
> existing modules.  (mobdebug was very difficult to deal with and I'm not
> sure that I was able to catch every case.)
>
> No S2N was fine, however.
>

One followup:

This hack, suggested by Roberto, was helpful:

getmetatable''.__concat = function (a,b)
  return tostring(a) .. tostring(b)
end