lua-users home
lua-l archive

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


No, of course, I mean in the actual task (double recursion) I would want something like this

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

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.)

Fredrik

________________________________________
Från: lua-l-bounces@lists.lua.org [lua-l-bounces@lists.lua.org] för HyperHacker [hyperhacker@gmail.com]
Skickat: den 15 juni 2011 17:28
Till: Lua mailing list
Ämne: Re: SV: pack/unpack

On Wed, Jun 15, 2011 at 09:04, Fredrik Widlund
<fredrik.widlund@qbrick.com> wrote:
> Ok, but the below example can of course trivially be rewritten as
> a=f()
> b,c=g()
>
> Whereas I can't rewrite around my problem...
>
> Fredrik

Sure you can, it's just not as pretty:

> a={1,2,3}
> b={4,5,6}
> c={unpack(a)}
> for _,v in ipairs(b) do c[#c+1]=v end

--
Sent from my toaster.