summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--TODO5
-rw-r--r--luatexbase-loader.dtx18
3 files changed, 17 insertions, 7 deletions
diff --git a/Changes b/Changes
index b6462b1..ece39b4 100644
--- a/Changes
+++ b/Changes
@@ -19,6 +19,7 @@
luatexbase-loader
- require"foo.bar" now looks for foo/bar then foo.bar, see doc for
details
+ - better cooperation with the original package loader
- works with luatex 0.25.4
2010/03/28
diff --git a/TODO b/TODO
index e1c02ef..b81d103 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,3 @@
-loader
-------
-
-- write doc
-
modutils
--------
diff --git a/luatexbase-loader.dtx b/luatexbase-loader.dtx
index 432a66d..c3eb1f6 100644
--- a/luatexbase-loader.dtx
+++ b/luatexbase-loader.dtx
@@ -338,11 +338,23 @@ local function find_module_file(mod)
end
% \end{macrocode}
%
+% Combined searcher, using primarily the new kpse searcher, and the
+% original as a fall-back.
+%
% \begin{macrocode}
+local package_loader_two = package.loaders[2]
local function load_module(mod)
local file = find_module_file(mod)
if not file then
- return "\n\t[luatexbase.loader] Search failed"
+ local msg = "\n\t[luatexbase.loader] Search failed"
+ local ret = package_loader_two(mod)
+ if type(ret) == 'string' then
+ return msg..ret
+ elseif type(ret) == 'nil' then
+ return msg
+ else
+ return ret
+ end
end
local loader, error = loadfile(file)
if not loader then
@@ -353,8 +365,10 @@ local function load_module(mod)
end
% \end{macrocode}
%
+% Finally install this combined loader as loader 2.
+%
% \begin{macrocode}
-table.insert(package.loaders, 2, load_module)
+package.loaders[2] = load_module
%</luamodule>
% \end{macrocode}
%