How to check if a meta Table is empty?

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

Its something with the value your storing in the table. Can’t tell you why its not working correctly

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
1 Like

Thank you i figured it was something like this

The universal thing to check if a table is empty is to directly use next

local isTableEmpty = (next(tab) == nil)
2 Likes

thats more accurate and simpler plus it gave me insights to scripting thanks