From a7b3420111190209e7985d4bd657321cbeb505cf Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 11 Mar 2024 13:44:22 -0600 Subject: [PATCH] PR #696: updated docs and code for hook.register() function --- docs/source/170_hooks.rst | 2 +- src/Hook.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/170_hooks.rst b/docs/source/170_hooks.rst index 5560b8124..07fd8f788 100644 --- a/docs/source/170_hooks.rst +++ b/docs/source/170_hooks.rst @@ -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 diff --git a/src/Hook.lua b/src/Hook.lua index 67492c666..9588a6047 100644 --- a/src/Hook.lua +++ b/src/Hook.lua @@ -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