How do you compare two tables with equal values but different orders?

!

local function CompareTables(t1, t2)
	local function hasTable(tab)
		for i, v in pairs(tab) do
			if type(v) == "table" then
				return true
			end
		end
		return false
	end
	
	local function compare(t1, t2)
		if #t1 ~= #t2 then
			return false
		end

		local equalTables = true
		local matches = {}
		for i, v in pairs(t1) do
			if type(v) == "table" and hasTable(t2) then
				for i, x in pairs(t2) do
					if type(x) == "table" and not table.find(matches, x) then
						equalTables = compare(v, x)
						matches[#matches + 1] = x
					end
				end
			elseif type(v) ~= "table" then	
				if not table.find(t2, v) then
					return false
				end	
			end
		end	
		return equalTables
	end
	
	return compare(t1, t2)
end

print(CompareTables(t1, t2))