summaryrefslogtreecommitdiff
path: root/luatexbase-attr.dtx
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-02 16:39:24 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-02 16:39:24 +0200
commitd17162ae3da3b7bbf5272322061d9c824eccf782 (patch)
treeb9d210e23783e5f162b3263655bde8fdcf7c26bc /luatexbase-attr.dtx
parentec9d2665e95c90f27f2529072a0616f7156ea13f (diff)
downloadluatexbase-d17162ae3da3b7bbf5272322061d9c824eccf782.tar.gz
avoid shadowing locals
Diffstat (limited to 'luatexbase-attr.dtx')
-rw-r--r--luatexbase-attr.dtx18
1 files changed, 13 insertions, 5 deletions
diff --git a/luatexbase-attr.dtx b/luatexbase-attr.dtx
index 859803e..209ffd6 100644
--- a/luatexbase-attr.dtx
+++ b/luatexbase-attr.dtx
@@ -356,15 +356,23 @@ local texiowrite = texio.write
local whatsit_t = nodetype"whatsit"
local user_defined_t = nodesubtype"user_defined"
-luatexbase = luatexbase or { }
-local luatexbase = luatexbase
+luatexbase = luatexbase or { }
+local luatexbase = luatexbase
% \end{macrocode}
%
% This table holds the values of the allocated attributes, indexed by name.
%
% \begin{macrocode}
-attributes = {}
+luatexbase.attributes = luatexbase.attributes or { }
+local attributes = luatexbase.attributes
+% \end{macrocode}
+%
+% Scoping: we use locals for the attribute functions.
+%
+% \begin{macrocode}
+local new_attribute
+local unset_attribute
% \end{macrocode}
%
% In the \luatex ecosystem there are currently two functions that create a
@@ -396,7 +404,7 @@ end
%
% \begin{macrocode}
local last_alloc = 0
-local function new_attribute(name, silent)
+function new_attribute(name, silent)
if last_alloc >= 65535 then
if silent then
return -1
@@ -427,7 +435,7 @@ luatexbase.new_attribute = new_attribute
%
% \begin{macrocode}
local unset_value = (luatexbase.luatexversion < 37) and -1 or -2147483647
-local function unset_attribute(name)
+function unset_attribute(name)
tex.setattribute(attributes[name], unset_value)
end
luatexbase.unset_attribute = unset_attribute