Skip to content

Commit

Permalink
Ensure we have a table to check
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim committed Jul 25, 2024
1 parent 9a26d29 commit 9542c6a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ Works for associative tables as opposed to `#table`.
function addon:tsize(tbl)
-- would really like Lua 5.2 for this
local size = 0
for _ in next, tbl do
size = size + 1
if tbl then
for _ in next, tbl do
size = size + 1
end
end
return size
end
Expand Down

0 comments on commit 9542c6a

Please sign in to comment.