lua-users home
lua-l archive

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


On 26 July 2013 11:17, Andrew Starks <andrew.starks@trms.com> wrote:
> Finally, __tonumber just feels... missing. I even had to triple check
> that it wasn't in 5.2, lest I embarrass myself. :)

I agree, this would allow for a best-effort conversion of various
numerical libraries (e.g. big nums, vectors, etc)
It also provides a good duality when compared to __tostring.

FWIW, luajit supports tonumber on numerical cdata objects (e.g. I can
tonumber() a uint32_t)

Though I wonder, with the addition of integers, do we need a
tofloatingpoint() and tointeger() (where tonumber would be a alias for
the former)

D