Differences From
Artifact [6f943d189b]:
51 51 new[k] = fn.deepcopy(v)
52 52 else
53 53 new[k] = v
54 54 end
55 55 end
56 56 return new
57 57 end
58 +
59 +fn.append = function(r1, r2)
60 + local new = fn.copy(r1)
61 + for i=1,#r2 do
62 + new[#new + 1] = r2[i]
63 + end
64 + return new
65 +end
58 66
59 67 fn.merge = function(base,override)
60 68 local new = fn.copy(base)
61 69 for k,v in pairs(override) do
62 70 new[k] = v
63 71 end
64 72 return new
65 73 end
66 74
67 75 fn.deepmerge = function(base,override,func)
68 76 local new = {}
69 - local keys = fn.merge(fn.keys(base),fn.keys(override))
77 + local keys = fn.append(fn.keys(base),fn.keys(override))
70 78 for _,k in pairs(keys) do
71 79 if type(base[k]) == 'table' and
72 80 type(override[k]) == 'table' then
73 81 new[k] = fn.deepmerge(base[k], override[k], func)
74 82 elseif func and override[k] and base[k] then
75 83 new[k] = func(base[k],override[k], k)
76 84 elseif override[k] then
77 85 new[k] = override[k]
78 86 else
79 87 new[k] = base[k]
80 88 end
81 89 end
82 - return new
83 -end
84 -
85 -fn.append = function(r1, r2)
86 - local new = fn.copy(r1)
87 - for i=1,#r2 do
88 - new[#new + 1] = r2[i]
89 - end
90 90 return new
91 91 end
92 92
93 93 fn.has = function(tbl,value,eqfn)
94 94 for k,v in pairs(tbl) do
95 95 if eqfn then
96 96 if eqfn(v,value,tbl) then return true, k end