lua-users home
lua-l archive

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

The only way I know to count non-indexed values in a table is like this:

function countFields(t)
 local count = 0
 for k, v in pairs(t) do
   count = count + 1
 return count

Does anyone have a better solution?

Matt Campbell
Lead Programmer
Serotek Corporation
"The Accessibility Anywhere People"