lua-users home
lua-l archive

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

> Is there a better way to do this ? (I would like to avoid the 
> recursion's overhead and to destroy the table)

I don't know how to avoid the recursion, but you can keep the table intact:

  function unpack (t, i)
    i = i or 1
    if (i <= getn(t)) then
      return t[i], unpack(t, i+1)

-- Roberto