[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to determine true size of a table?
- From: "Adam D. Moss" <adam@...>
- Date: Thu, 02 Mar 2006 16:51:54 +0000
David Given wrote:
On Thursday 02 March 2006 16:33, Adam D. Moss wrote:
I guess something like this is what's wanted:
You could replace the ipairs look with simply #t (or table.getn(t) on 5.0),
although that will only work for valid arrays (i.e. tables with non-nil
numeric elements from 1 to n).
I did note this in the post you cite... I don't know whether
'Chris' intended this to work with sparse numeric parts of
the array, but I've not ever felt the need for a non-integer-index
counting function in the first place. :)