local function updateData(tb1, tb2)-- 对比table,将tb2的数据同步到tb1,无论多少级table,都可以做到同步
if type(tb1)=="table" and type(tb2)=="table" then
for i,v in pairs(tb2) do
if tb1[i] and type(tb1[i])==type(v)=="table" then
updateData(tb1[i], v)
else
tb1[i] = v
end
end
end
end
深度同步两个table的数据
最新推荐文章于 2021-02-07 02:34:08 发布