mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
Changed lume.count() to return length if table is array
This commit is contained in:
parent
a42cbb12f0
commit
067e58b30f
3
lume.lua
3
lume.lua
@ -265,6 +265,9 @@ function lume.count(t, fn)
|
|||||||
if fn(v) then count = count + 1 end
|
if fn(v) then count = count + 1 end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
if isarray(t) then
|
||||||
|
return #t
|
||||||
|
end
|
||||||
for k in iter(t) do count = count + 1 end
|
for k in iter(t) do count = count + 1 end
|
||||||
end
|
end
|
||||||
return count
|
return count
|
||||||
|
Loading…
Reference in New Issue
Block a user