[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: use of gettop to change functionality
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 2 Mar 2011 10:43:21 +0200
On Wed, Mar 2, 2011 at 10:27 AM, Axel Kittenberger <axkibe@gmail.com> wrote:
> It would be cool if we could do:
> for i, v in ... do
> tough, without having to pack ...
And impossible, because the bit following 'in' isn't just a simple
function! For instance, io.lines() returns a function on Lua 5.1, but
LuaJIT 2.0 returns a function and a file object; (i)pairs always
returns two items.
However, a simple C extension P could be written that could make 'for
i,v in P(...) do' pretty optimal - it's very efficient to access
multiple arguments in C.
steve d.