mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-26 01:03:46 +01:00
Add table.count_equals
This commit is contained in:
parent
494d109833
commit
d4c6468cec
@ -350,6 +350,15 @@ function count(table)
|
|||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function count_equals(table, count)
|
||||||
|
local k
|
||||||
|
for _ = 1, count do
|
||||||
|
k = next(table, k)
|
||||||
|
if k == nil then return false end -- less than n keys
|
||||||
|
end
|
||||||
|
return next(table, k) == nil -- no (n + 1)th entry
|
||||||
|
end
|
||||||
|
|
||||||
function is_empty(table)
|
function is_empty(table)
|
||||||
return next(table) == nil
|
return next(table) == nil
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user