Revision Difference
GM:Initialize#527816
<function name="Initialize" parent="GM" type="hook">
<ishook>yes</ishook>
<description>Called after the gamemode loads and starts.</description>
<realm>Shared</realm>
</function>
<example>
<description>"hi" will be printed to the console when the gamemode initializes.</description>
<code>
function GM:Initialize()
print("hi" )
end
-- That way you are overriding the default hook⤶
-- you can use hook.Add to make more functions get called on initialization⤶
local function init()
print("Initialization hook called")
end⤶
hook.Add( "Initialize", "some_unique_name", init )⤶
-- That way you are overriding the default hook.⤶
-- You can use hook.Add to make more functions get called on initialization.⤶
hook.Add( "Initialize", "some_unique_name", function()
print( "Initialization hook called" )
end )⤶
</code>
<outputfixedwidth>Fixed Width</outputfixedwidth>⤶
<output>⤶
Initializtion hook called⤶
hi⤶
</output>⤶
⤶
</example> <output>`Initializtion hook called` and `hi`</output>⤶
</example>