Garry's Mod Wiki

Revision Difference

Entity:DTVar#515760

<function name="DTVar" parent="Entity" type="classfunc">⤶ <description>⤶ <internal></internal>⤶ ⤶ Sets up a self.dt.NAME alias for a Data Table variable.⤶ ⤶ <warning>You should use <page>Entity:NetworkVar</page> instead</warning>⤶ </description>⤶ <realm>Shared</realm>⤶ <args>⤶ <arg name="Type" type="string">The type of the DTVar being set up. It can be one of the following: &#x27;Int&#x27;, &#x27;Float&#x27;, &#x27;Vector&#x27;, &#x27;Angle&#x27;, &#x27;Bool&#x27;, &#x27;Entity&#x27; or &#x27;String&#x27;</arg>⤶ <arg name="ID" type="number">The ID of the DTVar. Can be between 0 and 3 for strings, 0 and 31 for everything else.</arg>⤶ <arg name="Name" type="string">Name by which you will refer to DTVar. It must be a valid variable name. (No spaces!)</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Sets up two float networked variables, **TargetZ** and **Speed**</description>⤶ <code>⤶ function ENT:SetupDataTables()⤶ ⤶ self:DTVar( "Float", 0, "TargetZ" )⤶ self:DTVar( "Float", 1, "Speed" )⤶ ⤶ end⤶ </code>⤶ ⤶ </example>