-- there is no way to achieve this other than to create your own function.
-- using #table ("#" is shorthand for table.getn(table)) won't factor in key names.
function table_length(t)
local z = 0
for i,v in pairs(t) do z = z + 1 end
return z
end