Skip to content

Commit ea9bd06

Browse files
committed
Update C_Console.GetAllCommands to ConsoleGetAllCommands for 10.2
1 parent 2338a29 commit ea9bd06

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cvars.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,21 +1022,24 @@ local CategoryNames = { -- not sure how meaningful these really are (/Blizzard_C
10221022
}
10231023

10241024
--[[
1025-
C_Console.GetAllCommands() returns a list of tables in this format:
1025+
ConsoleGetAllCommands() returns a list of tables in this format:
10261026
category: number from 0 to 9 representing a category above
10271027
command: cvar name
10281028
commandType: 0 seems to represent a cvar, 1 is a script command (like quit)
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+
10321035
function addon:CVarExists(cvar)
10331036
return not not select(2, pcall(function() return GetCVarInfo(cvar) end))
10341037
end
10351038

10361039
-- Returns filtered list of CVars
10371040
function addon:GetCVars()
10381041
local cvars = {}
1039-
for _, info in ipairs(C_Console.GetAllCommands()) do
1042+
for _, info in ipairs(ConsoleGetAllCommands()) do
10401043
if info.commandType == 0 -- cvar, rather than script
10411044
and info.category ~= 0 -- ignore debug category
10421045
and not strfind(info.command:lower(), 'debug') -- a number of commands with "debug" in their name are inexplicibly not in the "debug" category

0 commit comments

Comments
 (0)