From ea9bd063b1d6b74b56e6f5f664995e7f00beb8a8 Mon Sep 17 00:00:00 2001 From: semlar Date: Sat, 14 Oct 2023 14:07:31 -0400 Subject: [PATCH] Update C_Console.GetAllCommands to ConsoleGetAllCommands for 10.2 --- cvars.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cvars.lua b/cvars.lua index aaaa709..acc6b8e 100644 --- a/cvars.lua +++ b/cvars.lua @@ -1022,13 +1022,16 @@ local CategoryNames = { -- not sure how meaningful these really are (/Blizzard_C } --[[ - C_Console.GetAllCommands() returns a list of tables in this format: + ConsoleGetAllCommands() returns a list of tables in this format: category: number from 0 to 9 representing a category above command: cvar name commandType: 0 seems to represent a cvar, 1 is a script command (like quit) help: cvar description text --]] +-- C_Console.GetAllCommands is now ConsoleGetAllCommands as of 10.2.0 +local ConsoleGetAllCommands = ConsoleGetAllCommands or C_Console and C_Console.GetAllCommands + function addon:CVarExists(cvar) return not not select(2, pcall(function() return GetCVarInfo(cvar) end)) end @@ -1036,7 +1039,7 @@ end -- Returns filtered list of CVars function addon:GetCVars() local cvars = {} - for _, info in ipairs(C_Console.GetAllCommands()) do + for _, info in ipairs(ConsoleGetAllCommands()) do if info.commandType == 0 -- cvar, rather than script and info.category ~= 0 -- ignore debug category and not strfind(info.command:lower(), 'debug') -- a number of commands with "debug" in their name are inexplicibly not in the "debug" category