lua-users home
lua-l archive

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


I think

local counter = 0
for _ in pairs(t) do counter = counter + 1 end

might be better (faster, simpler?)

Cheers,
Geoff

On 26/03/2008, at 1:13 PM, Raul Gerardo Huertas Paiva wrote:
So, to get the number of entries in a table y must do somethig like:


counter = 0;--The counter

function addcounter
     counter = counter+1;
end

Foreach( tabla, addcounter)  --PetitteVersion


???
Is this correct? :S