Hooks
Last updated
Last updated
Updated for version 3.38.
The module inherits ModuleBase. All parameters and functions of this class are inherited by the module.
The name of the module you use as the meta of the module definition is 'Hooks' or 'HooksModule' if _force_search
is set to true in the module definition.
<Hooks directory type>
Parameter | Type | Description |
---|---|---|
<hook type file source_file use_clbk/>
Parameter | Type | Description |
---|---|---|
Both
This example is what you would put inside your main node within your mod config
And if you are using the use_clbk, have something like this:
For this example your hook will be here: mods/MyMod/Hooks/Setup.lua
. If you are using this module in a BLT mod.
<hooks>
exampleNow it will be in: mods/MyMod/Hooks/Other/Setup.lua
.
Parameter | Type | Description |
---|---|---|
Function | Description |
---|---|
directory
String
Directory/path relative to the mods directory which contains all the hooked. [OPTIONAL]
source_file
String
The path of the lua source file you wish to hook to. [REQ]
file
String
File path of the file that is hooking to the source_file
[REQ]
type
String
The type of hook. If this is set to pre
then the hook will be called before the source_file is loaded. Otherwise, it will be called after (Mostly for pre hooks)
pre
Boolean
Like type
but as a quick boolean value to set to pre hooks
post
Boolean
Like type
but as a quick boolean value to set to post hooks (Very specific cases as post is default)
Load(Table config, String prev_div)
Called normally by the module's init function. This is what adds the hooks. config
is the current looping hooks table (or self._config if not present) and prev_dir
is the previous directory so it will join the directory to it
GetPath(String directory, String prev_dir)
Joins directory and prev_dir. If prev_dir is not present returns directory alone. Used by the Load function