Only add a module to the list once, no matter how many times it is added in the squishy file

Mon, 27 Jul 2009 03:59:39 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 27 Jul 2009 03:59:39 +0100
changeset 37
cb8b48b08e1e
parent 36
bbfbc08d568f
child 38
903128a42604

Only add a module to the list once, no matter how many times it is added in the squishy file

squish.lua file | annotate | diff | comparison | revisions
--- a/squish.lua	Mon Jul 27 03:54:38 2009 +0100
+++ b/squish.lua	Mon Jul 27 03:59:39 2009 +0100
@@ -38,8 +38,13 @@
 --  Functions to be called from squishy file  --
 
 function Module(name)
+	if modules[name] then
+		print_verbose("Ignoring duplicate module definition for "..name);
+		return function () end
+	end
 	local i = #modules+1;
 	modules[i] = { name = name, url = ___fetch_url };
+	modules[name] = modules[i];
 	return function (path)
 		modules[i].path = path;
 	end

mercurial