[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple values returned or vararg expression in numeric for loop
- From: Seppl Vorderhörer <Seppl.Vorderhoerer@...>
- Date: Sun, 16 Sep 2012 12:00:12 +0200
After all this endless discussion about "for" syntax one simple question:
Why not simply write
local function f() return 1, 5 end
local a,b = f()
for i = a,b do print(i) end
although I have to admit, that then you have to distinguish between two
or three parameters for the for-loop "manually".
Am 13.09.2012 14:10, schrieb Egor Skriptunoff:
Why this simple code
for i = 1, 5 do print(i) end
cannot be written in more general form ?
local function f() return 1, 5 end
for i = f() do print(i) end
-- Egor