[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 'table' as fallback for tables
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 28 Jun 2016 08:29:41 +0200
On Tue, Jun 28, 2016 at 8:07 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 1. If the __index metamethod exists, use it.
> 2. If not, use tbl["#"] as the length.
> 3. If that is nil or false, revert to the built-in algorithm.
Assume that '__len' is meant, not '__index'
Why not simply leave out (2)? Imagine having to explain how #t works
in a future manual.
However, I'm all for table.pack() returning a table which has a
metatable with __len = self.n, and table.unpack() respecting this.
- References:
- 'table' as fallback for tables, Dirk Laurie
- Re: 'table' as fallback for tables, Philipp Janda
- Re: 'table' as fallback for tables, Roberto Ierusalimschy
- Re: 'table' as fallback for tables, Philipp Janda
- Re: 'table' as fallback for tables, Tim Hill
- Re: 'table' as fallback for tables, Philipp Janda
- Re: 'table' as fallback for tables, Roberto Ierusalimschy
- Re: 'table' as fallback for tables, Philipp Janda
- Re: 'table' as fallback for tables, Coda Highland
- Re: 'table' as fallback for tables, Jay
- Re: 'table' as fallback for tables, Tim Hill
- Re: 'table' as fallback for tables, Dirk Laurie