diff options
Diffstat (limited to 'luatexbase-mcb.dtx')
-rw-r--r-- | luatexbase-mcb.dtx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/luatexbase-mcb.dtx b/luatexbase-mcb.dtx index f4d6448..9070c8f 100644 --- a/luatexbase-mcb.dtx +++ b/luatexbase-mcb.dtx @@ -392,7 +392,8 @@ See the aforementioned source file(s) for copyright and licensing information. % \subsubsection{Module identification} % % \begin{macrocode} -module('luatexbase', package.seeall) +luatexbase = luatexbase or { } +local luatexbase = luatexbase local err, warning, info, log = luatexbase.provides_module({ name = "luatexbase-mcb", version = 0.5, @@ -627,7 +628,7 @@ local handlers = { % Add a function to a callback. First check arguments. % % \begin{macrocode} -function add_to_callback (name,func,description,priority) +local function add_to_callback (name,func,description,priority) if type(func) ~= "function" then return err("unable to add function:\nno proper function passed") end @@ -690,12 +691,13 @@ function add_to_callback (name,func,description,priority) log("inserting '%s'\nat position %s in '%s'", description, priority, name) end +luatexbase.add_to_callback = add_to_callback % \end{macrocode} % % Remove a function from a callback. First check arguments. % % \begin{macrocode} -function remove_from_callback (name, description) +local function remove_from_callback (name, description) if not name or name == "" then err("unable to remove function:\nno proper callback name passed") return @@ -742,13 +744,14 @@ function remove_from_callback (name, description) end return end +luatexbase.remove_from_callback = remove_from_callback % \end{macrocode} % % Remove all the functions registered in a callback. Unregisters the % callback handler unless the callback is user-defined. % % \begin{macrocode} -function reset_callback (name, make_false) +local function reset_callback (name, make_false) if not name or name == "" then err("unable to reset:\nno proper callback name passed") return @@ -767,13 +770,14 @@ function reset_callback (name, make_false) end end end +luatexbase.reset_callback = reset_callback % \end{macrocode} % % Get a function's priority in a callback list, or false if the function is % not in the list. % % \begin{macrocode} -function priority_in_callback (name, description) +local function priority_in_callback (name, description) if not name or name == "" or not callbacktypes[name] or not description then @@ -788,6 +792,7 @@ function priority_in_callback (name, description) end return false end +luatexbase.priority_in_callback = priority_in_callback % \end{macrocode} % % \subsubsection{Public functions for user-defined callbacks} @@ -804,7 +809,7 @@ end % callback must also call it, see next function. % % \begin{macrocode} -function create_callback(name, ctype, default) +local function create_callback(name, ctype, default) if not name then err("unable to call callback:\nno proper name passed", name) return nil @@ -827,13 +832,14 @@ function create_callback(name, ctype, default) lua_callbacks_defaults[name] = default callbacktypes[name] = ctype end +luatexbase.create_callback = create_callback % \end{macrocode} % % This function calls a callback. It can only call a callback created by % the \texttt{create} function. % % \begin{macrocode} -function call_callback(name, ...) +local function call_callback(name, ...) if not name then err("unable to call callback:\nno proper name passed", name) return nil @@ -855,6 +861,7 @@ function call_callback(name, ...) end return f(...) end +luatexbase.call_callback = call_callback % \end{macrocode} % % That's all folks! |