Garry's Mod Wiki

Revision Difference

Entity:DTVar#563386

<function name="DTVar" parent="Entity" type="classfunc"> <description> <internal><br/><br/>You should use <page>Entity:NetworkVar</page> instead</internal> Sets up a self.dt.NAME alias for a Data Table variable. </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: 'Int', 'Float', 'Vector', 'Angle', 'Bool', 'Entity' or 'String'</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>⤶ <arg name="type" type="string">The type of the DTVar being set up. Supported choices:⤶ ⤶ * `String` (up to 511 characters)⤶ * `Bool`⤶ * `Float`⤶ * `Int` (32-bit signed integer)⤶ * `Vector`⤶ * `Angle`⤶ * `Entity`</arg>⤶ <arg name="slot" type="number">The ID of the DTVar. Can be between `0` and `3` for strings, `0` and `31` for everything else.⤶ ⤶ This can be omitted entirely (arguments will shift) and it will use the next available slot.</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>⤶ <args name="Slot argument is omitted">⤶ <arg name="type" type="string">The type of the DTVar being set up. Supported choices:⤶ ⤶ * `String` (up to 511 characters)⤶ * `Bool`⤶ * `Float`⤶ * `Int` (32-bit signed integer)⤶ * `Vector`⤶ * `Angle`⤶ * `Entity`</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>