lua-users home
lua-l archive

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


On Mon, Jun 18, 2018 at 11:33 PM Luiz Henrique de Figueiredo wrote:
Lua 5.4.0 (work2) is now available for testing


The manual says:
for v = e1, e2, e3 do block end
is equivalent to the code:
do
  local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3)
  ...


If tonumber("1") is integer, why does loop variable contain float value?

> tonumber("1")
1
> for j = "1", 2 do print(j) end
1.0
2.0