yaml-merge

changeset 2
0653a782618c
parent 0
0757d85e604b
--- a/yaml-merge	Sat Dec 17 18:25:25 2011 +0000
+++ b/yaml-merge	Mon Jan 16 21:42:31 2012 +0000
@@ -7,12 +7,9 @@
 	if type(t1) == "table" and type(t2) == "table" then
 		local array = {};
 		if depth < 2 then -- numeric
-			for i,v in ipairs(t1) do
-				array[v] = true;
-				t1[i] = nil;
-			end
 			for i,v in ipairs(t2) do
 				array[v] = true;
+				table.insert(t1, v);
 			end
 		end
 		for k,v in pairs(t2) do -- non-numeric
@@ -20,9 +17,6 @@
 				t1[k] = merge_in(t1[k], v, depth + 1);
 			end
 		end
-		for v in pairs(array) do
-			table.insert(t1, v);
-		end
 	elseif t2 ~= nil then
 		t1 = t2;
 	end

mercurial