Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- lualoader.lua: make LuaTeX's "require" behave more like Lua's -- This file: -- http://angg.twu.net/dednat5/lualoader.lua -- http://angg.twu.net/dednat5/lualoader.lua.html -- (find-angg "dednat5/lualoader.lua") -- -- Loaded by: -- (find-dn5 "dednat6.lua" "luatex-require") -- (find-dn5 "dednat6.lua" "luatex-require" "lualoader") -- Code taken from: -- http://tug.org/pipermail/luatex/2015-February/005073.html -- http://lua-users.org/wiki/LuaModulesLoader -- (find-es "luatex" "require") -- (find-LATEX "lualoader.lua") -- (find-LATEXgrep "grep -nH -e lualoader *.tex") -- -- Compatibility: package.loaders = package.loaders or package.searchers loadstring = loadstring or load local function lualoader(modulename) local errmsg = "" -- Find source local modulepath = string.gsub(modulename, "%.", "/") for path in string.gmatch(package.path, "([^;]+)") do local filename = string.gsub(path, "%?", modulepath) local file = io.open(filename, "rb") if file then -- Compile and return the module return assert(loadstring(assert(file:read("*a")), filename)) end errmsg = errmsg.."\n\tno file '"..filename.."' (checked with custom loader)" end return errmsg end -- See http://www.lua.org/manual/5.1/manual.html#pdf-package.loaders table.insert(package.loaders, 2, lualoader) -- Local Variables: -- coding: raw-text-unix -- End: