Permalink
Browse files

GetConVar moved to Lua for caching (like GetConVarNumber/GetConVarStr…

…ing)
  • Loading branch information...
1 parent d3d6523 commit ced7ae207d60af3f77779b30630cce91029e1981 @willox willox committed Dec 1, 2016
Showing with 4 additions and 4 deletions.
  1. +4 −4 garrysmod/lua/includes/util.lua
@@ -406,10 +406,10 @@ end
local ConVarCache = {}
-local function GetConVarCached( name )
+function GetConVar( name )
local c = ConVarCache[ name ]
if not c then
- c = GetConVar( name )
+ c = GetConVar_Internal( name )
if not c then
return
end
@@ -422,12 +422,12 @@ end
function GetConVarNumber( name )
if ( name == "maxplayers" ) then return game.MaxPlayers() end -- Backwards compatibility
- local c = GetConVarCached( name )
+ local c = GetConVar( name )
return ( c and c:GetFloat() ) or 0
end
function GetConVarString( name )
if ( name == "maxplayers" ) then return tostring( game.MaxPlayers() ) end -- ew
- local c = GetConVarCached( name )
+ local c = GetConVar( name )
return ( c and c:GetString() ) or ""
end

2 comments on commit ced7ae2

@Kefta
Contributor
Kefta commented on ced7ae2 Dec 1, 2016

Do we really need to hold people's hands for not caching the GetConVar return?

@willox
Collaborator
willox commented on ced7ae2 Dec 1, 2016

yep

Please sign in to comment.