summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--luatexbase-attr.dtx32
1 files changed, 17 insertions, 15 deletions
diff --git a/luatexbase-attr.dtx b/luatexbase-attr.dtx
index 5f15aa1..2e09e6b 100644
--- a/luatexbase-attr.dtx
+++ b/luatexbase-attr.dtx
@@ -132,10 +132,12 @@ See source file '\inFileName' for details.
%
% \section{Documentation}
%
-% The main macro defined here is |\newattribute|. It behaves in the same
-% way as |\newcount|. There are also two helper macros: |\setattribute|
+% \subsection{\tex interface}
+%
+% The main macro defined here is |\newluatexattribute|. It behaves in the same
+% way as |\newcount|. There are also two helper macros: |\setluatexattibute|
% sets an attribute's value (locally, but you can use |\global| in front of
-% it). |\unsetattribute| unsets an atribute by giving it a special
+% it). |\unsetluatexattribute| unsets an attribute by giving it a special
% value, depending on \luatex's version; you should always use this macro
% in order to be sure the correct special value for your version of \luatex is
% used.
@@ -149,7 +151,7 @@ See source file '\inFileName' for details.
% The various Lua functions for manipulating attributes use a number to
% designate the attribute. Hence, package writers need a way to know the
% number of the attribute associated to |\fooattr| assuming it was defined
-% using |\newattribute\fooattr|, something that \luatex currently
+% using |\newluatexattribute\fooattr|, something that \luatex currently
% doesn't support (you can get the current value of the associated attribute
% as |tex.atrribute.fooattr|, but not the attribute number).
%
@@ -157,7 +159,7 @@ See source file '\inFileName' for details.
% extract the number at any time from the |\meaning| of |\foobar|.
% Alternatively, one could look at |\the\allocationnumber| just after the
% definition of |\fooattr| and remember it in a Lua variable. For your
-% convenience, this is automatically done by |\newattribute|: the number
+% convenience, this is automatically done by |\newluatexattribute|: the number
% is remembered in a dedicated Lua table so that you can get it as
% |luatexbase.attributes.foobar| (mind the absence of backslash here) at any
% time.
@@ -309,7 +311,7 @@ See source file '\inFileName' for details.
% macros.
%
% \begin{macrocode}
-\def\newattribute#1{%
+\def\newluatexattribute#1{%
\begingroup\escapechar\m@ne \expandafter\expandafter\expandafter
\endgroup \expandafter\expandafter\expandafter
\allocationnumber \luatexbase@directlua{tex.write(
@@ -318,14 +320,14 @@ See source file '\inFileName' for details.
\global\luatexattributedef#1=\allocationnumber
\wlog{\string#1=\string\luatexattribute\the\allocationnumber}%
\else
- \errmessage{No room for a new \string\luatexattribute}%
+ \errmessage{No room for a new \string\attribute}%
\fi}
% \end{macrocode}
%
-% Helper macro |\unsetattribute|: wrapper around the Lua function.
+% Helper macro |\unsetluatexattribute|: wrapper around the Lua function.
%
% \begin{macrocode}
-\def\unsetattribute#1{%
+\def\unsetluatexattribute#1{%
\begingroup\escapechar\m@ne
\luatexbase@directlua{%
luatexbase.unset_attribute("\luatexluaescapestring{\string#1}")}%
@@ -335,7 +337,7 @@ See source file '\inFileName' for details.
% And now the trivial helper macro.
%
% \begin{macrocode}
-\def\setattribute#1#2{%
+\def\setluatexattribute#1#2{%
#1=\numexpr#2\relax}
% \end{macrocode}
%
@@ -409,18 +411,18 @@ end
%<testplain>\input luatexbase-attr.sty
%<testlatex>\RequirePackage{luatexbase-attr}
%<*testplain,testlatex>
-\newattribute\testattr
-\setattribute\testattr{1}
-\unsetattribute\testattr
+\newluatexattribute\testattr
+\setluatexattribute\testattr{1}
+\unsetluatexattribute\testattr
\catcode64 11
\luatexbase@directlua{assert(luatexbase.attributes.testattr)}
\luatexbase@directlua{luatexbase.new_attribute('luatestattr')}
\luatexbase@directlua{assert(luatexbase.attributes.luatestattr)}
\begingroup
\escapechar64
-\newattribute\anotherattr
+\newluatexattribute\anotherattr
\endgroup
-\setattribute\anotherattr{1}
+\setluatexattribute\anotherattr{1}
\luatexbase@directlua{assert(luatexbase.attributes.anotherattr)}
%</testplain,testlatex>
%<testplain>\bye