[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to clone a table in LJ2-friendly way?
- From: "Dimiter \"malkia\" Stanev" <malkia@...>
- Date: Sat, 27 Aug 2011 03:24:50 -0700
On 8/27/11 3:09 AM, Alexander Gladysh wrote:
On Sat, Aug 27, 2011 at 13:56, Dimiter "malkia" Stanev<email@example.com> wrote:
Here is one more version, still not lj2 friendly, but for some reason very
much lua friendly (no closure, using directly next iterator):
Now that's a bit crazy. Will have read the bytecode as soon as I'll have time.
Reading the lua docs and wiki it seems that pairs() returns a closure,
table, and key. The closure is the next iterator.
Now here I'm directly calling the function next(table, key), instead of
the returned closure from pairs(). Probably I'm not doing something
legal (metatables? metatable iterators (lua 5.2)?)
Check it again, I can't be sure.