squish.lua

changeset 22
cb14d8c0d0f7
parent 21
27c2e279f0f3
child 23
e3b923ccadb1
--- a/squish.lua	Sun Jul 26 03:38:20 2009 +0100
+++ b/squish.lua	Sun Jul 26 03:59:35 2009 +0100
@@ -212,7 +212,21 @@
 						return io_lines(fn);
 					else
 						return vio.open(resources[fn]):lines()
-					end end ]]
+				end end
+				local _dofile = dofile;
+				function dofile(fn)
+					if not resources[fn] then
+						return _dofile(fn);
+					else
+						return assert(loadstring(resources[fn]))();
+				end end
+				local _loadfile = loadfile;
+				function loadfile(fn)
+					if not resources[fn] then
+						return _loadfile(fn);
+					else
+						return loadstring(resources[fn], "@"..fn);
+				end end ]]
 		end
 	end
 	f:write[[function require_resource(name) return resources[name] or error("resource '"..tostring(name).."' not found"); end end ]]

mercurial