[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table.unpack(...) and the __index metamethod
- From: Coda Highland <chighland@...>
- Date: Fri, 13 Jun 2014 23:00:27 -0700
On Fri, Jun 13, 2014 at 10:37 PM, Tim Hill <drtimhill@gmail.com> wrote:
>
> On Jun 13, 2014, at 5:22 PM, Thiago L. <fakedme@gmail.com> wrote:
>
>>>
>>> No, the OP pointed out that the overhead of doing the metamethod test in table.unpack() is low, since it can be done once at the start of unpack(), which then chooses a (fast) rawgeti() based loop or a (generic) index metamethod loop. So you get the best of both worlds in one API.
>>>
>>> —Tim
>>>
>> What if we want raw unpacking of metatabled tables? (aka keep nil as nil)
>
> 1. Save metatable from table
> 2. Set metatable on table to nil
> 3. Unpack it
> 4. Restore metatable
>
> —Tim
>
>
Until someone sets __metatable.
/s/ Adam