Why is GetConVarNumber deprecated and cvars.Number is not?
4 replies, posted
Here is the code for cvars.Number - [URL="https://github.com/Facepunch/garrysmod/blob/784cd57576d85712fa13a7cea3a9523b4df966b0/garrysmod/lua/includes/modules/cvars.lua#L121"]https://github.com/Facepunch/garrysmod/blob/784cd57576d85712fa13a7cea3a9523b4df966b0/garrysmod/lua/includes/modules/cvars.lua#L121[/URL]
It is shown that cvars.Number uses GetConVarNumber.
On the Wiki, [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/GetConVarNumber]GetConVarNumber[/url] is deprecated, but [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/cvars/Number]cvars.Number[/url] is not. So, why is cvars.Number using a deprecated function, but is not deprecated itself?
Really, the entire cvars library should be deprecated and the callback function should be implemented as a hook.
[QUOTE=code_gs;52884715]Really, the entire cvars library should be deprecated and the callback function should be implemented as a hook.[/QUOTE]
What if you want to check a convar without having caught it?
[QUOTE=NeatNit;52884859]What if you want to check a convar without having caught it?[/QUOTE]
[CODE]
GetConVar( "trash" ):GetString()
[/CODE]
Of course, this enforces bad behaviours, and caching always speeds things up
[QUOTE=MPan1;52884865][CODE]
GetConVar( "trash" ):GetString()
[/CODE]
Of course, this enforces bad behaviours, and caching always speeds things up[/QUOTE]
GetConVar caches internally too so there's even less need for those functions.
Sorry, you need to Log In to post a reply to this thread.