[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.2 - small enhancement for table.unpack
- From: Matthew Wild <mwild1@...>
- Date: Wed, 29 Jun 2011 10:27:24 +0100
On 29 June 2011 10:26, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Wed, Jun 29, 2011 at 11:20 AM, Patrick Rapin <toupie300@gmail.com> wrote:
>> The function table.pack could also set a metatable with then __len
>> metamethod returning the true length, since table.unpack already obey
>> __len metamethod.
>
> That is a most elegant solution, I think.
>
Until someone tries to modify the returned table and then wonders why
the length doesn't change accordingly? :)
Regards,
Matthew