Garry's Mod Wiki

Revision Difference

hook.Run#545743

<function name="Run" parent="hook" type="libraryfunc"> <description> Calls hooks associated with the given event. Calls all hooks associated with the given event **until** one returns something other than `nil` and then returns that data. If no hook returns any data, it will try to call the `GAMEMODE:<eventName>`; alternative, if one exists. Calls all hooks until one returns something other than nil and then returns that data. If no hook returns any data, it will try to call the GAMEMODE:&lt;eventName&gt; alternative, if one exists. This function internally calls <page>hook.Call</page>. See also: <page>gamemode.Call</page> - same as this, but does not call hooks if the gamemode hasn't defined the function. </description> <realm>Shared and Menu</realm> <file line="52-L59">lua/includes/modules/hook.lua</file> <args> <arg name="eventName" type="string">The event to call hooks for</arg> <arg name="args" type="vararg">The arguments to be passed to the hooks</arg> <arg name="eventName" type="string">The event to call hooks for.</arg> <arg name="args" type="vararg">The arguments to be passed to the hooks.</arg> </args> <rets> <ret name="" type="any">Returned data from called hooks</ret> <ret name="" type="any">Returned data from called hooks.</ret> </rets> </function>