How to know if a table is a dictionary?

I need to have a function that returns true when something is a dictionary. I saw a function but it does not work with numerical keys. This is my function

if next(t) == nil then
		return "Empty" 

	local Array = true
	local Dictionary = true

	for k, _ in next, t do
		if typeof(k) == "number" and k%1 == 0 and k > 0 then
			Dictionary = false
			Array = false
	if Array then
		return "Array"
	elseif Dictionary then
		return "Dict"
		return "Mixed"

If I give this a dictionary which has numerical key’s it will return an Array. Is there a way to cut it down to only return true if its a dictionary and work with all types of dictionaries whether they be numerical keys or string keys

1 Like