lua-users home
lua-l archive

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

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. :)