summaryrefslogtreecommitdiff
path: root/luatexbase-loader.dtx
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-03-29 14:51:36 +0200
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-03-29 14:51:36 +0200
commit145e048da74c921d3ef2865e2f95793480b8b315 (patch)
tree96eaaf65bfb0e243499079cc8107f70d9a3f6f26 /luatexbase-loader.dtx
parentb34fb130a4ccbf9aad49f1cecd33074c80337857 (diff)
downloadluatexbase-145e048da74c921d3ef2865e2f95793480b8b315.tar.gz
Better cooperation with original package loader.
Diffstat (limited to 'luatexbase-loader.dtx')
-rw-r--r--luatexbase-loader.dtx18
1 files changed, 16 insertions, 2 deletions
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}
%