This overrides garry’s default hook system. We need this better hook system for any serious development. We’re implementing hook priorities. hook.Add() now takes an additional parameter of type number between -20 and 20. 0 is default (so we remain backwards compatible). -20 and 20 are read only (ignores returned values). Hooks are called in order from -20 on up.
| Hook | This overrides garry’s default hook system. |
| Functions | |
| hook. | The table filled with all the hooks in a format that is backwards compatible with garry’s. |
| hook.Add | Our new and improved hook.Add function. |
| hook. | |
| hook.Call | Normally, you don’t want to call this directly. |
| hook. | Returns the hooks that are currently processing, if any. |
| hook. | Returns true if the specified hook is currently processing |
Our new and improved hook.Add function. Read the file description for more information on how the hook priorities work.
| event_name | The name of the event (IE “PlayerInitialSpawn”). |
| name | The unique name of your hook. This is only so that if the file is reloaded, it can be unhooked (or you can unhook it yourself). |
| func | The function callback to call |
| priority | (Optional, defaults to 0) Priority from -20 to 20. Remember that -20 and 20 are read-only. |