From 14d38e579414e56e3b9cc1b13a075efb034f7568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 29 Mar 2010 04:14:20 +0200 Subject: Abstraction for \directlua. --- TODO | 2 +- luatexbase-compat.dtx | 19 ++++++++++++++++++- 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. %\input luatexbase-compat.sty %\RequirePackage{luatexbase-compat} %<*testplain,testlatex> +\catcode64 11 +\luatexbase@directlua{local answer = 42} % %\bye %\stop -- cgit v1.2.3