lua-users home
lua-l archive

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


On Tue, Mar 25, 2008 at 3:06 AM, steve donovan <steve.j.donovan@gmail.com> wrote:
Because getn or # only gives you the number of array-like entries in the table!

So the length of {1,2,beta=3} is 2; {alice=1,bob=2} has length 0.

Generally to count all elements of a table, you need to do a foreach
or pairs loop.

Is the foreach still available? I don't see it in the table library documentation. Sorry for such a simple question, but I like the idea of using foreach, but only if it is going to be in Lua for many versions to come. Thanks.
--
Regards,
Ryan