mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-29 18:53:44 +01:00
Add table.deep_to_add
This commit is contained in:
parent
04a33ca841
commit
0edb8d378f
12
table.lua
12
table.lua
@ -373,6 +373,18 @@ end
|
|||||||
|
|
||||||
difference = to_add
|
difference = to_add
|
||||||
|
|
||||||
|
function deep_to_add(table, after_additions)
|
||||||
|
local additions = {}
|
||||||
|
for key, value in pairs(after_additions) do
|
||||||
|
if type(table[key]) == "table" and type(value) == "table" then
|
||||||
|
additions[key] = deep_to_add(table[key], value)
|
||||||
|
elseif table[key] ~= value then
|
||||||
|
additions[key] = value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return additions
|
||||||
|
end
|
||||||
|
|
||||||
function add_all(table, additions)
|
function add_all(table, additions)
|
||||||
for key, value in pairs(additions) do
|
for key, value in pairs(additions) do
|
||||||
table[key] = value
|
table[key] = value
|
||||||
|
Loading…
Reference in New Issue
Block a user