ConVar.GetString

From GMod Wiki

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



Examples

DescriptionThis example shows how the GetString method translates different data types and values
Used onNewerClient.png
Code
local convar1 = CreateClientConVar("__testconvar_string_1",0)
local convar2 = CreateClientConVar("__testconvar_string_2","0")
local convar3 = CreateClientConVar("__testconvar_string_3",1)
local convar4 = CreateClientConVar("__testconvar_string_4","1")
local convar5 = CreateClientConVar("__testconvar_string_5",1.3)
local convar6 = CreateClientConVar("__testconvar_string_6","1.3")
local convar7 = CreateClientConVar("__testconvar_string_7","lolstring")
local convar8 = CreateClientConVar("__testconvar_string_8","")
Msg("Command 1: "..tostring(convar1:GetString()).."\n")
Msg("Command 2: "..tostring(convar2:GetString()).."\n")
Msg("Command 3: "..tostring(convar3:GetString()).."\n")
Msg("Command 4: "..tostring(convar4:GetString()).."\n")
Msg("Command 5: "..tostring(convar5:GetString()).."\n")
Msg("Command 6: "..tostring(convar6:GetString()).."\n")
Msg("Command 7: "..tostring(convar7:GetString()).."\n")
Msg("Command 8: "..tostring(convar8:GetString()).."\n")
Output
Command 1: 0
Command 2: 0
Command 3: 1
Command 4: 1
Command 5: 1.3
Command 6: 1.3
Command 7: lolstring
Command 8: 


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox