From c554ada26ffc925e520a5fb026272065a3671ff7 Mon Sep 17 00:00:00 2001
From: Elie Roux <elie.roux@telecom-bretagne.eu>
Date: Sun, 7 Apr 2013 19:28:51 +0200
Subject: Fixing package loading for LuaTeX > 0.74

Starting from LuaTeX 0.74, Lua 5.2 is used, and packages.loaders
is renamed into packages.searchers, which makes luatexbase and
thus almost all LuaLaTeX packages broken.

This commit fixes it, keeping backward compatibility.
---
 luatexbase-loader.dtx | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

(limited to 'luatexbase-loader.dtx')

diff --git a/luatexbase-loader.dtx b/luatexbase-loader.dtx
index 3bf1b47..92e97b2 100644
--- a/luatexbase-loader.dtx
+++ b/luatexbase-loader.dtx
@@ -374,10 +374,16 @@ end
 %    \end{macrocode}
 %
 %    Combined searcher, using primarily the new kpse searcher, and the
-%    original as a fall-back.
+%    original as a fall-back. Starting from \luatex 0.75, Lua 5.2 is used. Among 
+%    the changes, |package.loaders| is renamed as |package.searchers|.
 %
 %    \begin{macrocode}
-local package_loader_two = package.loaders[2]
+local package_loader_two
+if package.searchers then
+  package_loader_two = package.searchers[2]
+else
+  package_loader_two = package.loaders[2]
+end
 local function load_module(mod)
   local file = find_module_file(mod)
   if not file then
@@ -403,7 +409,11 @@ end
 %    Finally install this combined loader as loader 2.
 %
 %    \begin{macrocode}
-package.loaders[2] = load_module
+if package.searchers then
+  package.searchers[2] = load_module
+else
+  package.loaders[2] = load_module
+end
 %</luamodule>
 %    \end{macrocode}
 %
-- 
cgit v1.2.3

