Entity/DTVar

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=DTVar
+
|Description={{Internal}}
|Parent=Entity
+
 
|Description=Sets up a self.dt.NAME alias for a [[DTVars| Data Table var]]
+
Sets up a self.dt.NAME alias for a Data Table variable.
| Arg1Name = Type
+
 
| Arg1Type = string
+
{{Warning|You should use {{ClassFunction|Entity|NetworkVar}} instead}}
| Arg1Desc = The type of the DTVar being set up. It can be one of the following: 'Int', 'Float', 'Vector', 'Angle', 'Bool', 'Entity' or 'String'
+
| Arg2Name = ID
+
| Arg2Type = number
+
| Arg2Desc = The ID of the DTVar. Can be between 0 and 3
+
| Arg3Name = Name
+
| Arg3Type = string
+
| Arg3Desc = Name by which you will refer to DTVar. It must be a valid variable name. (No spaces!)
+
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=Yes
 
|IsClass=Yes
Line 19: Line 12:
 
|name=Type
 
|name=Type
 
|desc=The type of the DTVar being set up. It can be one of the following: 'Int', 'Float', 'Vector', 'Angle', 'Bool', 'Entity' or 'String'
 
|desc=The type of the DTVar being set up. It can be one of the following: 'Int', 'Float', 'Vector', 'Angle', 'Bool', 'Entity' or 'String'
| Arg2Name = ID
 
| Arg2Type = number
 
| Arg2Desc = The ID of the DTVar. Can be between 0 and 3
 
| Arg3Name = Name
 
| Arg3Type = string
 
| Arg3Desc = Name by which you will refer to DTVar. It must be a valid variable name. (No spaces!)
 
 
}}
 
}}
 
{{Arg
 
{{Arg
 
|type=number
 
|type=number
 
|name=ID
 
|name=ID
|desc=The ID of the DTVar. Can be between 0 and 3
+
|desc=The ID of the DTVar. Can be between 0 and 3 for strings, 0 and 31 for everything else.
| Arg3Name = Name
+
| Arg3Type = string
+
| Arg3Desc = Name by which you will refer to DTVar. It must be a valid variable name. (No spaces!)
+
 
}}
 
}}
 
{{Arg
 
{{Arg
Line 40: Line 24:
 
}}
 
}}
 
{{Example
 
{{Example
| Description = Sets up two float networked variables, '''TargetZ''' and '''Speed'''  
+
|Description=Sets up two float networked variables, '''TargetZ''' and '''Speed'''
| Code = function ENT:SetupDataTables()
+
|Code=function ENT:SetupDataTables()
  
self:DTVar( "Float", 0, "TargetZ" );
+
self:DTVar( "Float", 0, "TargetZ" )
self:DTVar( "Float", 1, "Speed" );
+
self:DTVar( "Float", 1, "Speed" )
  
 
end
 
end
 
}}
 
}}

Latest revision as of 10:26, 16 January 2019

 Entity:DTVar( )

Contents

Description

This is an internal function or feature.
This means you will be able to use it, but you really shouldn't.

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

WARNING

You should use Entity:NetworkVar instead

Arguments

string Type

The type of the DTVar being set up. It can be one of the following: 'Int', 'Float', 'Vector', 'Angle', 'Bool', 'Entity' or 'String'

Arguments

number ID

The ID of the DTVar. Can be between 0 and 3 for strings, 0 and 31 for everything else.

Arguments

string Name

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

Examples

Example

Sets up two float networked variables, TargetZ and Speed

function ENT:SetupDataTables()

	self:DTVar( "Float", 0, "TargetZ" )
	self:DTVar( "Float", 1, "Speed" )

end


Personal tools
Navigation