diff --git a/lib/utils/utils.lua b/lib/utils/utils.lua index b5c0362..f152dde 100644 --- a/lib/utils/utils.lua +++ b/lib/utils/utils.lua @@ -74,4 +74,20 @@ function P.lerp(from, to, t) return from + (to - from) * t end +--- Compares two tables by their fields +--- @param t1 table +--- @param t2 table +--- @return boolean +function P.deepComprasion(t1, t2) + for k, v in pairs(t1) do + if type(v) == "table" and type(t2[k]) == "table" then + return P.deepComprasion(v, t2[k]) + end + if t2[k] ~= v then + return false + end + end + return true +end + return P