lua-users home
lua-l archive

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


* On 2014-03-23 20:40:24 +0100, Roberto Ierusalimschy wrote:
 
> I think it is really easy to disable this coercion in Lua; all it takes
> is a simple change in lvm.c (see below). It would be very helpful if
> people try that in the wild and report their experiences here in the
> list.
> 
> Lua 5.1 and Lua 5.2:
> @@ -35,10 +35,6 @@
>  const TValue *luaV_tonumber (const TValue *obj, TValue *n) {
>    lua_Number num;
>    if (ttisnumber(obj)) return obj;
> -  if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) {
> -    setnvalue(n, num);
> -    return n;
> -  }
>    else
>      return NULL;
>  }

I guess an explicit conversion from string to number is still supposed
to work? With the above patch on 5.2:

=tonumber("3")
nil

-- 
:wq
^X^Cy^K^X^C^C^C^C