summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--luaextra.dtx54
1 files changed, 35 insertions, 19 deletions
diff --git a/luaextra.dtx b/luaextra.dtx
index 2ae0e8a..0f450d5 100644
--- a/luaextra.dtx
+++ b/luaextra.dtx
@@ -189,27 +189,43 @@ end
kpse.set_program_name("luatex")
% \end{macrocode}
-% Load the individual modules.
+% We could load the modules with |require|, but this works only from version
+% 0.44, and doesn't work in Debian, so we simply use |dofile|.
% \begin{macrocode}
-require("luaextra-string.lua")
-require("luaextra-lpeg.lua")
-require("luaextra-boolean.lua")
-require("luaextra-number.lua")
-require("luaextra-math.lua")
-require("luaextra-table.lua")
-require("luaextra-aux.lua")
-require("luaextra-io.lua")
-require("luaextra-os.lua")
-require("luaextra-file.lua")
-require("luaextra-md5.lua")
-require("luaextra-dir.lua")
-require("luaextra-unicode.lua")
-require("luaextra-utils.lua")
-require("luaextra-dimen.lua")
-require("luaextra-url.lua")
-require("luaextra-set.lua")
-require("luaextra-dimen.lua")
+local function load_luaextra_module(filename)
+ local path = kpse.find_file(filename)
+ if not path then
+ texio.write_nl(string.format("luaextra: error: cannot find file %s", filename))
+ return
+ end
+ texio.write_nl('log', string.format("luaextra: loading file %s", path))
+ --if (tex and tex.luatexversion and tex.luatexversion > 44)
+ -- or (status and status.luatex_version and status.luatex_version > 44) then
+ -- require(filename)
+ --else
+ dofile(path)
+ --end
+end
+
+load_luaextra_module("luaextra-string.lua")
+load_luaextra_module("luaextra-lpeg.lua")
+load_luaextra_module("luaextra-boolean.lua")
+load_luaextra_module("luaextra-number.lua")
+load_luaextra_module("luaextra-math.lua")
+load_luaextra_module("luaextra-table.lua")
+load_luaextra_module("luaextra-aux.lua")
+load_luaextra_module("luaextra-io.lua")
+load_luaextra_module("luaextra-os.lua")
+load_luaextra_module("luaextra-file.lua")
+load_luaextra_module("luaextra-md5.lua")
+load_luaextra_module("luaextra-dir.lua")
+load_luaextra_module("luaextra-unicode.lua")
+load_luaextra_module("luaextra-utils.lua")
+load_luaextra_module("luaextra-dimen.lua")
+load_luaextra_module("luaextra-url.lua")
+load_luaextra_module("luaextra-set.lua")
+load_luaextra_module("luaextra-dimen.lua")
% \end{macrocode}
% Aliases for backward compatibility.