squish.lua

changeset 22
cb14d8c0d0f7
parent 21
27c2e279f0f3
child 23
e3b923ccadb1
equal deleted inserted replaced
21:27c2e279f0f3 22:cb14d8c0d0f7
210 function io.lines(fn) 210 function io.lines(fn)
211 if not resources[fn] then 211 if not resources[fn] then
212 return io_lines(fn); 212 return io_lines(fn);
213 else 213 else
214 return vio.open(resources[fn]):lines() 214 return vio.open(resources[fn]):lines()
215 end end ]] 215 end end
216 local _dofile = dofile;
217 function dofile(fn)
218 if not resources[fn] then
219 return _dofile(fn);
220 else
221 return assert(loadstring(resources[fn]))();
222 end end
223 local _loadfile = loadfile;
224 function loadfile(fn)
225 if not resources[fn] then
226 return _loadfile(fn);
227 else
228 return loadstring(resources[fn], "@"..fn);
229 end end ]]
216 end 230 end
217 end 231 end
218 f:write[[function require_resource(name) return resources[name] or error("resource '"..tostring(name).."' not found"); end end ]] 232 f:write[[function require_resource(name) return resources[name] or error("resource '"..tostring(name).."' not found"); end end ]]
219 end 233 end
220 234

mercurial