Garry's Mod Wiki

Entity:DTVar

  Entity:DTVar( string type, number slot, string name )
  Entity:DTVar( string type, string name )

Description

This is used internally - although you're able to use it you probably shouldn't.

You should use Entity:NetworkVar instead

Sets up a self.dt.NAME alias for a Data Table variable.

Default Arguments

1 string type
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
2 number slot
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.

3 string name
Name by which you will refer to DTVar. It must be a valid variable name. (No spaces!)

Argument Overload: Slot argument is omitted

1 string type
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
2 string name
Name by which you will refer to DTVar. It must be a valid variable name. (No spaces!)

Example

Sets up two float networked variables, TargetZ and Speed

function ENT:SetupDataTables() self:DTVar( "Float", 0, "TargetZ" ) self:DTVar( "Float", 1, "Speed" ) end