17,105
edits
(formatnum: Use faster variant of function) |
(tableIsEmpty: Initial implementation) |
||
Line 101: | Line 101: | ||
for _ in pairs(table) do count = count + 1 end | for _ in pairs(table) do count = count + 1 end | ||
return count | return count | ||
else | |||
return nil | |||
end | |||
end | |||
-- Returns true if the table is empty, false otherwise | |||
function p.tableIsEmpty(table) | |||
if type(table) == 'table' then | |||
for k, v in pairs(table) do | |||
return false | |||
end | |||
return true | |||
else | else | ||
return nil | return nil |