i encouter this when i tried to check if my meta table is emprty and for some reason it always printed empty i posted a script i tested this and yet again it printed empty so how do i check is with meta table?
local Tab = {
["Sc"] = {['falme'] = 1},
}
if #Tab == 0 then
print("empty")
end
it prints empty
but as you can see the table is not empty
Dictionaries don’t have length, as they are stored differently from a regular table. That means you can’t use table.length nor # on them as they’ll both return 0.
I believe the only way to check if it’s empty or not is by running a for loop on it
local function isEmpty(t)
for i, v in pairs(t) do
return false
end
return true
end