lua-users home
lua-l archive

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


The

for var_1, ..., var_n in explist do block end

syntax is documented to be equivalent to

do
  local _f, _s, var_1 = explist
  while 1 do
    local var_2, ..., var_n
    var_1, ...., var_n = _f(_s, var_1)
    if var_1 == nil then break end
    block
  end
end

I suppose the syntax was chosen with some
convenient usage scenarios in mind. What
are they? I have not been able to construct
one that does not look convoluted.

---
Albert-Jan