lua-users home
lua-l archive

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


> >> There is no direct conversion from strings to integers:
> >> If a string is provided where an integer is needed,
> >> Lua converts the string to a float and then the float to an integer.
> Does it mean the following:
> assert('100000000000000001'%2 == 0)

Yes.


> It looks unnaturally for a language having 64-bit integers as native
> datatype.

Coercion from strings to numbers are considered a bad thing, and can
(should?) be removed in future versions. It did not seem worth to extend
to the new integer stuff something already outdate. (Ideally it should
raise an error, but that would create all sorts of incompatibilities.)

In other words, it is unnatural, but the whole coercion stuff is unnatural.

-- Roberto