Skip to content

Commit

Permalink
PR #696: updated docs and code for hook.register() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Mar 11, 2024
1 parent fa25724 commit a7b3420
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/170_hooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ load hook::
hook.register("load", load_hook_b, "append") -- appends to the previous hook function.

-- > the following will run load_hook_b then load_hook_a
hook.register("load", load_hook_a) - -- initializes the load hook function
hook.register("load", load_hook_a) -- initializes the load hook function
hook.register("load", load_hook_b, "prepend") -- prepends to the previous hook function

Note that if the optional third argument (the action argument) is
Expand Down
1 change: 1 addition & 0 deletions src/Hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function M.register(name, func, action)
LmodWarning{msg="w_Unknown_Hook_Action",action = tostring(action)}
end

-- Save func depending on action
if (action == "replace") then
validT[name] = {func}
elseif (action == "append") then
Expand Down

0 comments on commit a7b3420

Please sign in to comment.