summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--luatexbase-compat.dtx19
2 files changed, 19 insertions, 2 deletions
diff --git a/TODO b/TODO
index f2f94f8..ace6580 100644
--- a/TODO
+++ b/TODO
@@ -6,7 +6,6 @@ general
compat
------
-- \luadirect abstraction to \directlua
- \EnsureLuaTeXPrimitive
- use it in other packages, and test them with various versions
@@ -14,6 +13,7 @@ loader
------
- make a real test using a fake texmf tree as TEXMFHOME?
+- anyway, give it some real testing with luatex < 0.43!
- ensure compatibility with older versions of LuaTeX (no 'lua' type for
kpse.find_file).
- Make a decision about the behaviour (discuss this with Heiko & all)
diff --git a/luatexbase-compat.dtx b/luatexbase-compat.dtx
index a6cb7bd..bbb73c6 100644
--- a/luatexbase-compat.dtx
+++ b/luatexbase-compat.dtx
@@ -207,10 +207,25 @@ See source file '\inFileName' for details.
\fi
% \end{macrocode}
%
-% \subsection{Actually do stuff}
+% \subsection{\cs{directlua} abstraction}
%
+% Define |\luatexbase@directlua| to be either |\directlua0| or
+% |\directlua|, depending on the version of \luatex.
%
% \begin{macrocode}
+\begingroup
+\expandafter\ifx\csname newcommand\endcsname\relax
+ \toks0{\long\def\luatexbase@directlua}%
+\else
+ \toks0{\newcommand\luatexbase@directlua}%
+\fi
+\ifnum\luatexversion<36
+ \toks0\expandafter{\the\toks0{\directlua0}}%
+\else
+ \toks0\expandafter{\the\toks0{\directlua}}%
+\fi
+\expandafter\endgroup
+\the\toks0
% \end{macrocode}
%
% That's all folks!
@@ -228,6 +243,8 @@ See source file '\inFileName' for details.
%<testplain>\input luatexbase-compat.sty
%<testlatex>\RequirePackage{luatexbase-compat}
%<*testplain,testlatex>
+\catcode64 11
+\luatexbase@directlua{local answer = 42}
%</testplain,testlatex>
%<testplain>\bye
%<testlatex>\stop