Garry's Mod Wiki

Revision Difference

Global.Add_NPC_Class#514829

<function name="Add_NPC_Class" parent="Global" type="libraryfunc">⤶ <description>Defines a global entity class variable with an automatic value in order to prevent collisions with other <page>CLASS</page>. You should prefix your variable with CLASS_ for consistency.</description>⤶ <realm>Shared and Menu</realm>⤶ <file line="370-L373">lua/includes/util.lua</file>⤶ <args>⤶ <arg name="name" type="string">The name of the new enum/global variable.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Creates a global variable named CLASS_TESTER and prints its value.</description>⤶ <code>⤶ Add_NPC_Class( "CLASS_TESTER" )⤶ print( CLASS_TESTER )⤶ </code>⤶ <output>36 (one greater than the current highest value of the <page>CLASS</page>)</output>⤶ ⤶ </example>