lua-users home
lua-l archive

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


When a string is converted to a number using coercion, it is converted to a floating point number, even if it does not contain a decimal point.  When the tonumber() function is used, a string without decimal point is converted to an integer:

Lua 5.3.2  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> a = 0
> a = 0 + '1'
> = a
1.0
> = tonumber('1')
1

Is this beviour intended? (and if yes, why?)