table扩展模块添加一个方法(未来会整理类似数据表更新函数)
This commit is contained in:
@@ -46,6 +46,18 @@ function TABLE.cover(new,old)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--For all things in new, push to old
|
||||||
|
function TABLE.coverR(new,old)
|
||||||
|
for k,v in next,new do
|
||||||
|
if type(v)=='table'and type(old[k])=='table'then
|
||||||
|
TABLE.coverR(v,old[k])
|
||||||
|
else
|
||||||
|
old[k]=v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--For all things in new if same type in old, push to old
|
--For all things in new if same type in old, push to old
|
||||||
function TABLE.update(new,old)
|
function TABLE.update(new,old)
|
||||||
for k,v in next,new do
|
for k,v in next,new do
|
||||||
|
|||||||
Reference in New Issue
Block a user