Skip to content

Commit d2bf5f4

Browse files
committed
Make sure 12.0 additions work for other client types as well
1 parent 538bb50 commit d2bf5f4

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

DevTool.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ DevTool.list = {}
3737
function DevTool:OnInitialize()
3838

3939
self.db = LibStub("AceDB-3.0"):New("DevToolDatabase", self.DatabaseDefaults)
40-
40+
4141
end
4242

4343
--- Called during the PLAYER_LOGIN event when most of the data provided by the game is already present.
4444
--- We perform more startup tasks here, such as registering events, hooking functions, creating frames, or getting
4545
--- information from the game that wasn't yet available during :OnInitialize()
4646
function DevTool:OnEnable()
47-
47+
4848
self:CreateChatCommands()
4949

5050
self.MainWindow = CreateFrame("Frame", "DevToolFrame", UIParent, "DevToolMainFrame")
@@ -235,12 +235,12 @@ function DevTool:AddData(data, dataName)
235235
return
236236
end
237237

238-
if issecrettable(data) then
238+
if issecrettable and issecrettable(data) then
239239
self:Print("Error: The data being added is a secret table. Aborting.")
240240
return
241241
end
242242

243-
if issecretvalue(data) then
243+
if issecretvalue and issecretvalue(data) then
244244
self:Print("Error: The data being added is a secret value. Aborting.")
245245
return
246246
end
@@ -765,7 +765,7 @@ function DevTool:ProcessCallFunctionData(ok, info, parent, args, results)
765765
-- for example 1, 2, nil, 4 should return only this 4 values nothing more, nothing less.
766766
local found = false
767767
for i = 10, 1, -1 do
768-
local result = DevTool.normalizeSecretValue(results[i])
768+
local result = DevTool.normalizeSecretValue(results[i])
769769
if result ~= nil then
770770
found = true
771771
end

Utilities/Utils.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ local DevTool = addonTable.DevTool
1010
--- UTILS
1111
-----------------------------------------------------------------------------------------------
1212

13-
function DevTool.normalizeSecretValue(value)
14-
if issecrettable(value) or issecretvalue(value) then
15-
return string.format("<SECRET %s>", type(value))
16-
end
17-
return value
18-
end
19-
2013
--- Math
2114

2215
function DevTool.round(num, idp)
@@ -172,7 +165,7 @@ end
172165

173166
function DevTool.ToUIString(value, name, withoutLineBrakes)
174167
local result
175-
value = DevTool.normalizeSecretValue(value)
168+
value = DevTool.normalizeSecretValue(value)
176169
local valueType = type(value)
177170

178171
if valueType == "table" then
@@ -198,7 +191,7 @@ function DevTool.GetObjectInfoFromWoWAPI(helperText, value)
198191
local concat = function(str, before, after)
199192
before = DevTool.normalizeSecretValue(before) or ""
200193
after = DevTool.normalizeSecretValue(after) or ""
201-
str = DevTool.normalizeSecretValue(str)
194+
str = DevTool.normalizeSecretValue(str)
202195
if str then
203196
return resultStr .. " " .. before .. str .. after
204197
end
@@ -220,7 +213,7 @@ function DevTool.GetObjectInfoFromWoWAPI(helperText, value)
220213
tostring(DevTool.round(height)) .. "]")
221214
end
222215

223-
name = DevTool.normalizeSecretValue(name)
216+
name = DevTool.normalizeSecretValue(name)
224217

225218
if helperText ~= name then
226219
resultStr = concat(name, DevTool.colors.gray:WrapTextInColorCode("<"), DevTool.colors.gray:WrapTextInColorCode(">"))
@@ -296,3 +289,10 @@ function DevTool.GetParentTable(info)
296289

297290
return parent
298291
end
292+
293+
function DevTool.normalizeSecretValue(value)
294+
if (issecrettable and issecrettable(value)) or (issecretvalue and issecretvalue(value)) then
295+
return string.format("<SECRET %s>", type(value))
296+
end
297+
return value
298+
end

0 commit comments

Comments
 (0)