table.getsize does not detect and count values when the key is a string
print(table.getsize({}))
-- arrayCount = 0, hashCount = 1
print(table.getsize({ mykey = "myvalue" }))
-- arrayCount = 0, hashCount = 1 /!\ /!\ /!\ /!\
print(table.getsize({ 1 }))
-- arrayCount = 1, hashCount = 1
Here is an implementation that returns the correct size:
function table.truesize(t)
local count = 0
for _, _ in pairs(t) do count += 1 end
return count
end