lua-users home
lua-l archive

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


>     function tsize(t)
>         local c = 0
>         for k,v in t do c=c+1 end
>         return c
>     end

...which is a generalisation of the neat little trick to find if a table
is empty:

function empty(t)
  for _, _ in t do
    return nil
  end
  return 1
end

-- 
http://www.mupsych.org/rrt/ | Slow Pedestrian Crossing