[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Tables, Metatables, Children, and Length
- From: Coda Highland <chighland@...>
- Date: Mon, 3 Dec 2012 17:49:23 -0800
On Mon, Dec 3, 2012 at 5:44 PM, Marc Lepage <mlepage@antimeta.com> wrote:
> Hi, I have a table which has a metatable. I want to add children (other
> tables) to the metatable, not to the table directly.
>
> If I do so, I can get at them by t[1], t[2], t[3] and so on.
>
> But I can't do this:
>
> for i = 1, #t do
> local child = t[i]
> end
>
> Because #t still returns 0.
>
> Comments and feedback welcome.
Isn't there a metamethod for length in Lua 5.2?
/s/ Adam
- Prev by Date:
Tables, Metatables, Children, and Length
- Next by Date:
Re: Tables, Metatables, Children, and Length
- Previous by thread:
Tables, Metatables, Children, and Length
- Next by thread:
Re: Tables, Metatables, Children, and Length
- Index(es):