function CompareTable(o,G,m)local O=type(o)local W=type(G)if O~=W then return false end if O~="\116\097\098\108\101"and W~="\116\097\098\108\101"then return o==G end local J=getmetatable(o)if not m and(J and J.__eq)then return o==G end for o,m in pairs(o)do local O=G[o]if O==nil or not CompareTable(m,O)then return false end end for G,m in pairs(G)do local O=o[G]if O==nil or not CompareTable(O,m)then return false end end return true end
--- Source: https://web.archive.org/web/20131225070434/http://snippets.luacode.org/snippets/Deep_Comparison_of_Two_Values_3
function CompareTable(t1, t2, ignore_mt)
	local ty1 = type(t1)
	local ty2 = type(t2)

	if ty1 ~= ty2 then
		return false
	end

	--- Non-table types can be directly compared
	if ty1 ~= "table" and ty2 ~= "table" then
		return t1 == t2
	end

	--- As well as tables which have the metamethod __eq
	local mt = getmetatable(t1)

	if not ignore_mt and mt and mt.__eq then
		return t1 == t2
	end

	for k1, v1 in pairs(t1) do
		local v2 = t2[k1]
		if v2 == nil or not CompareTable(v1, v2) then
			return false
		end
	end

	for k2, v2 in pairs(t2) do
		local v1 = t1[k2]

		if v1 == nil or not CompareTable(v1, v2) then
			return false
		end
	end

	return true
end
