lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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