ConVar.GetInt

From GMod Wiki

Jump to: navigation, search
Function
Syntax ConVar:GetInt( )
Description:
Retrieves an integer value from a ConVar object.
Returns: Integer
In Object: Convar
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=ConVar.GetInt]ConVar.GetInt [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis example shows how the GetInt method translates different data types and values
Used onNewerClient.png
Code
local convar1 = CreateClientConVar("__testconvar_int_1",0)
local convar2 = CreateClientConVar("__testconvar_int_2","0")
local convar3 = CreateClientConVar("__testconvar_int_3",1)
local convar4 = CreateClientConVar("__testconvar_int_4","1")
local convar5 = CreateClientConVar("__testconvar_int_5",1.3)
local convar6 = CreateClientConVar("__testconvar_int_6","1.3")
local convar7 = CreateClientConVar("__testconvar_int_7","lolstring")
local convar8 = CreateClientConVar("__testconvar_int_8","")
Msg("Command 1: "..tostring(convar1:GetInt()).."\n")
Msg("Command 2: "..tostring(convar2:GetInt()).."\n")
Msg("Command 3: "..tostring(convar3:GetInt()).."\n")
Msg("Command 4: "..tostring(convar4:GetInt()).."\n")
Msg("Command 5: "..tostring(convar5:GetInt()).."\n")
Msg("Command 6: "..tostring(convar6:GetInt()).."\n")
Msg("Command 7: "..tostring(convar7:GetInt()).."\n")
Msg("Command 8: "..tostring(convar8:GetInt()).."\n")
Output
Command 1: 0
Command 2: 0
Command 3: 1
Command 4: 1
Command 5: 1
Command 6: 1
Command 7: 0
Command 8: 0


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox