lua-users home
lua-l archive

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

On Wed, Jun 15, 2011 at 5:39 PM, Fredrik Widlund <> wrote:
No, of course, I mean in the actual task (double recursion) I would want something like this

function f(...)
   return f(...), f(...)

Which is not possible. I end up using appending tables etc. (Of course it's possible to remove the double recursion, or even recursion completely, but that's beside the point.)

Something like below? Your return line isn't a tail-call anyway, so it seems to have the functionality you wanted:

function f(...)
  -- ....
  local t = {f(...)}
  for _, v in ipairs{f(...)} do
    t[#t+1] = v
  return unpack(t)

(disclaimer: not compiled)

Mateusz Czapliński