lua-users home
lua-l archive

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


I don't know if this is intentional or an oversight, but I have
noticed that without the implicit string to number conversions (i.e.
`LUA_NOCVTS2N`) the `math.tointeger` function will return nil when
passed a string representation of a number.  By comparison, the
`tonumber`  function will convert strings to numbers explicitly
(obviously since that's exactly what it exists to do).

I know I can trivially monkey-patch `math.tointeger` to run its
arguments through `tonumber` first, but should `math.tointeger` also
explicitly convert strings to integers where possible?