[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: About the #(length) operator and table.getn
- From: "RJP Computing" <rjpcomputing@...>
- Date: Tue, 25 Mar 2008 14:09:20 -0400
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