cc-automation/util.lua
2025-05-15 17:14:39 +02:00

37 lines
646 B
Lua

local util = {}
function util.deepEqual(a, b)
local varType = type(a)
if varType ~= type(b) then
return false
end
if varType == "table" then
for key,_ in pairs(b) do
if a[key] == nil then
return false
end
end
for key,value in pairs(a) do
if not util.deepEqual(value, b[key]) then
return false
end
end
return true
end
return a == b
end
function util.find(array, f)
for _,v in pairs(array) do
if f(v) then
return v
end
end
return nil
end
return util