summaryrefslogtreecommitdiff
path: root/luatexbase-compat.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'luatexbase-compat.dtx')
-rw-r--r--luatexbase-compat.dtx27
1 files changed, 24 insertions, 3 deletions
diff --git a/luatexbase-compat.dtx b/luatexbase-compat.dtx
index c413bab..4d7f987 100644
--- a/luatexbase-compat.dtx
+++ b/luatexbase-compat.dtx
@@ -121,9 +121,9 @@ See source file '\inFileName' for details.
%
% \section{Documentation}
%
-% Two problems are currently addressed by this package: changes in the syntax
-% of |\directlua|, and variable policies for primitives activation and naming
-% (in \luatex itself as well as in \texlive).
+% Three problems are currently addressed by this package: changes in the
+% syntax of |\directlua|, version information, and variable policies for
+% primitives activation and naming (in \luatex itself as well as in \texlive).
%
% \medskip
%
@@ -141,6 +141,14 @@ See source file '\inFileName' for details.
%
% \medskip
%
+% Current versions of \luatex make the version available directly from Lua as
+% |tex.luatexversion| and |tex.luatexrevision|. However, older versions (such
+% as 0.25.4) didn't, which makes it particularly uneasy to test the version
+% from within Lua. The present package makes this information available as
+% |luatexbase.luatexversion| and |luatexbase.luatexrevision|.
+%
+% \medskip
+%
% Starting with \luatex 0.39.0, the only primitives available in Ini\tex mode
% are the basic primitives from \tex{}82 and |\directlua|. All other
% primitives are hidden by default and have to be activated using a Lua
@@ -298,6 +306,17 @@ See source file '\inFileName' for details.
\the\toks0
% \end{macrocode}
%
+% \subsection{Version information}
+%
+% Make |\luatexversion| and |\luatexrevision| available from Lua.
+%
+% \begin{macrocode}
+\luatexbase@directlua{%
+ luatexbase = luatexbase or {}
+ luatexbase.luatexversion = \number\luatexversion\space
+ luatexbase.luatexrevision = \number\luatexrevision\space}
+% \end{macrocode}
+%
% \subsection{Primitives}
%
% Try reasonably hard to activate a primitive. First, check if it is
@@ -379,6 +398,8 @@ See source file '\inFileName' for details.
\luatexbase@directlua{local answer = 42}
\luatexbase@ensure@primitive{primitive}
\luatexprimitive\relax
+\luatexbase@directlua{assert(type(luatexbase.luatexversion) == 'number')}
+\luatexbase@directlua{assert(type(luatexbase.luatexrevision) == 'number')}
%</testplain,testlatex>
%<testplain>\bye
%<testlatex>\stop