Skip to content

Commit cc65387

Browse files
committed
Fix missing GetCVarInfo function in Classic
1 parent bd3dd5a commit cc65387

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

AdvancedInterfaceOptions.toc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
## SavedVariables: AdvancedInterfaceOptionsSaved
1818

1919
semlib\semlib.xml
20+
utils.lua
2021
cvars.lua
2122
basicOptions.lua
2223
browser.lua

basicOptions.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ local SetCVar = function(...) -- Suppress errors trying to set read-only cvars
88
return status
99
end
1010

11+
local GetCVarInfo = addon.GetCVarInfo
12+
1113
local function IsClassic()
1214
return WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
1315
end

browser.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ local addonName, addon = ...
22
local _G = _G
33
local E = addon:Eve()
44

5+
-- local GetCVarInfo = addon.GetCVarInfo
6+
57
-- C_Console.GetAllCommands() does not return the complete list of CVars on login
68
-- Repopulate the list using UpdateCVarList() when the CVar browser is opened
79
local CVarList = {}

cvars.lua

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,17 +1029,10 @@ local CategoryNames = { -- not sure how meaningful these really are (/Blizzard_C
10291029
help: cvar description text
10301030
--]]
10311031

1032-
-- C_Console.GetAllCommands is now ConsoleGetAllCommands as of 10.2.0
1033-
local ConsoleGetAllCommands = ConsoleGetAllCommands or C_Console and C_Console.GetAllCommands
1034-
1035-
function addon:CVarExists(cvar)
1036-
return not not select(2, pcall(function() return GetCVarInfo(cvar) end))
1037-
end
1038-
10391032
-- Returns filtered list of CVars
10401033
function addon:GetCVars()
10411034
local cvars = {}
1042-
for _, info in ipairs(ConsoleGetAllCommands()) do
1035+
for _, info in ipairs(addon:GetAllCommands()) do
10431036
if info.commandType == 0 -- cvar, rather than script
10441037
and info.category ~= 0 -- ignore debug category
10451038
and not strfind(info.command:lower(), 'debug') -- a number of commands with "debug" in their name are inexplicibly not in the "debug" category

utils.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
local addonName, addon = ...
2+
3+
--------------------------------------
4+
-- Utility functions
5+
--------------------------------------
6+
7+
-- C_Console.GetAllCommands is now ConsoleGetAllCommands as of 10.2.0
8+
addon.GetAllCommands = ConsoleGetAllCommands or C_Console and C_Console.GetAllCommands
9+
10+
-- GetCVarInfo moved to C_CVar
11+
-- value, defaultValue, isStoredServerAccount, isStoredServerCharacter, isLockedFromUser, isSecure, isReadOnly
12+
addon.GetCVarInfo = GetCVarInfo or C_CVar and C_CVar.GetCVarInfo
13+
14+
function addon:CVarExists(cvar)
15+
return not not select(2, pcall(function() return addon.GetCVarInfo(cvar) end))
16+
end

0 commit comments

Comments
 (0)