summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-11-05 16:27:37 +0100
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-11-11 15:51:09 +0100
commit4e0902a4b8a7a492811fed4776e15777d1780f5f (patch)
treef349e03848fe4c067f72791aaee22c82fc712e44
parent3e5253b3c2cc7d952d39f010eec61b14d0a54135 (diff)
downloadluatexbase-4e0902a4b8a7a492811fed4776e15777d1780f5f.tar.gz
Simplify handlers (list never empty)
-rw-r--r--luatexbase-mcb.dtx27
1 files changed, 8 insertions, 19 deletions
diff --git a/luatexbase-mcb.dtx b/luatexbase-mcb.dtx
index 64e5b6c..9846011 100644
--- a/luatexbase-mcb.dtx
+++ b/luatexbase-mcb.dtx
@@ -527,29 +527,21 @@ end
% \begin{macrocode}
local function datahandler (name)
return function(data, ...)
- local l = callbacklist[name]
- if l then
- for _, f in ipairs(l) do
- data = f.func(data, ...)
- end
+ for _, f in ipairs(callbacklist[name]) do
+ data = f.func(data, ...)
end
- return data
end
end
% \end{macrocode}
%
-% Handler for |first| callbacks.
+% Handler for |first| callbacks. We can assume |callbacklist[name]| is not
+% empty: otherwise, the function wouldn't be registered in the callback any
+% more.
%
% \begin{macrocode}
local function firsthandler (name)
return function(...)
- local l = callbacklist[name]
- if l then
- local f = l[1].func
- return f(...)
- else
- return nil, false
- end
+ return callbacklist[name][1].func(...)
end
end
% \end{macrocode}
@@ -559,11 +551,8 @@ end
% \begin{macrocode}
local function simplehandler (name)
return function(...)
- local l = callbacklist[name]
- if l then
- for _, f in ipairs(l) do
- f.func(...)
- end
+ for _, f in ipairs(callbacklist[name]) do
+ f.func(...)
end
end
end