From 14d38e579414e56e3b9cc1b13a075efb034f7568 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= <mpg@elzevir.fr>
Date: Mon, 29 Mar 2010 04:14:20 +0200
Subject: Abstraction for \directlua.

---
 luatexbase-compat.dtx | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

(limited to 'luatexbase-compat.dtx')

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
-- 
cgit v1.2.3

