Merge pull request #1021 from Guldoman/PR_lax_common_merge
Make `common.merge` work with invalid arguments
This commit is contained in:
commit
92c6f1c04f
|
@ -18,9 +18,16 @@ end
|
||||||
|
|
||||||
|
|
||||||
function common.merge(a, b)
|
function common.merge(a, b)
|
||||||
|
a = type(a) == "table" and a or {}
|
||||||
local t = {}
|
local t = {}
|
||||||
for k, v in pairs(a) do t[k] = v end
|
for k, v in pairs(a) do
|
||||||
if b then for k, v in pairs(b) do t[k] = v end end
|
t[k] = v
|
||||||
|
end
|
||||||
|
if b and type(b) == "table" then
|
||||||
|
for k, v in pairs(b) do
|
||||||
|
t[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue