ConVar.GetBool

From GMod Wiki

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



Examples

DescriptionThis example shows how the GetBool method translates different data types and values
Used onNewerClient.png
Code
local convar1 = CreateClientConVar("__testconvar_bool_1",1)
local convar2 = CreateClientConVar("__testconvar_bool_2","1")
local convar3 = CreateClientConVar("__testconvar_bool_3","true")
local convar4 = CreateClientConVar("__testconvar_bool_4","arbitrary")
local convar5 = CreateClientConVar("__testconvar_bool_5",0)
local convar6 = CreateClientConVar("__testconvar_bool_6","0")
local convar7 = CreateClientConVar("__testconvar_bool_7","false")
local convar8 = CreateClientConVar("__testconvar_bool_8","")
Msg("ConVar 1: "..tostring(convar1:GetBool()).."\n")
Msg("ConVar 2: "..tostring(convar2:GetBool()).."\n")
Msg("ConVar 3: "..tostring(convar3:GetBool()).."\n")
Msg("ConVar 4: "..tostring(convar4:GetBool()).."\n")
Msg("ConVar 5: "..tostring(convar5:GetBool()).."\n")
Msg("ConVar 6: "..tostring(convar6:GetBool()).."\n")
Msg("ConVar 7: "..tostring(convar7:GetBool()).."\n")
Msg("ConVar 8: "..tostring(convar8:GetBool()).."\n")
Output
ConVar 1: true
ConVar 2: true
ConVar 3: false
ConVar 4: false
ConVar 5: false
ConVar 6: false
ConVar 7: false
ConVar 8: false


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox