From 87f7676bed961c8de29cc7fd2bebb41fe106f678 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Tue, 19 Jan 2010 18:55:31 +0200 Subject: Not relying on require() + error check require() doesn't work under LuaTeX 0.50 from Debian. I also added a check on the file discovery. --- luaextra.dtx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'luaextra.dtx') diff --git a/luaextra.dtx b/luaextra.dtx index 61fc1f5..0f450d5 100644 --- a/luaextra.dtx +++ b/luaextra.dtx @@ -189,21 +189,23 @@ end kpse.set_program_name("luatex") % \end{macrocode} -% We load the modules with |require| if the version of Lua\TeX{} is higher -% than 0.44, otherwise we simply load them with |dofile|. For |texlua| we -% cannot know the version of Lua\TeX{} so we load all the time with -% |dofile|. +% 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} local function load_luaextra_module(filename) local path = kpse.find_file(filename) - 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(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") -- cgit v1.2.3