summaryrefslogtreecommitdiff
path: root/luaextra.dtx
diff options
context:
space:
mode:
authorElie Roux <elie.roux@telecom-bretagne.eu>2010-01-19 18:55:31 +0200
committerElie Roux <elie.roux@telecom-bretagne.eu>2010-01-19 18:55:31 +0200
commit87f7676bed961c8de29cc7fd2bebb41fe106f678 (patch)
tree79dbdc0d20fe946dffabeb15de6dba7e9a20a273 /luaextra.dtx
parent4e0ad8a9c1a87477a1a4c2dad218c29c51123bab (diff)
downloadlualibs-87f7676bed961c8de29cc7fd2bebb41fe106f678.tar.gz
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.
Diffstat (limited to 'luaextra.dtx')
-rw-r--r--luaextra.dtx22
1 files changed, 12 insertions, 10 deletions
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")