From 48ea3e777f8432ed5fd33f72f92bd0111748d8b1 Mon Sep 17 00:00:00 2001 From: Ketho Date: Mon, 12 Aug 2019 04:35:32 +0200 Subject: [PATCH 1/3] Handle IsForbidden() frames --- Spew.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Spew.lua b/Spew.lua index 7493a37..3b7d441 100644 --- a/Spew.lua +++ b/Spew.lua @@ -44,7 +44,9 @@ local function pretty_tostring(value, depth) if t == "string" then return '|cff00ff00"'..value:gsub("|", "||"):gsub("([\001-\031\128-\255])", escape)..'"|r' elseif t == "table" then if depth > TABLEDEPTH then return "|cff9f9f9f{...}|r" - elseif type(rawget(value, 0)) == "userdata" and type(value.GetObjectType) == "function" then return "|cffffea00<"..value:GetObjectType()..":"..(value:GetName() or "(anon)")..">|r" + elseif type(rawget(value, 0)) == "userdata" and type(value.GetObjectType) == "function" then + if value.IsForbidden and value:IsForbidden() then return "|cffff0000|r" + else return "|cffffea00<"..value:GetObjectType()..":"..(value:GetName() or "(anon)")..">|r" end else return "|cff9f9f9f"..string.join(", ", TableToString(value, nil, nil, depth+1)).."|r" end elseif colors[t] then return colors[t]..tostring(value).."|r" else return tostring(value) end @@ -86,7 +88,8 @@ function Spew(input, a1, ...) if type(a1) == "table" then if type(rawget(a1, 0)) == "userdata" and type(a1.GetObjectType) == "function" then -- We've got a frame! - Print("|cffffea00<"..a1:GetObjectType()..":"..(a1:GetName() or input.."(anon)").."|r") + if a1:IsForbidden() then Print("|cffff0000 Date: Sun, 1 Sep 2019 20:31:43 +0200 Subject: [PATCH 2/3] Fixed GameTooltip:IsUnit() crash --- Spew.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spew.lua b/Spew.lua index 3b7d441..a6a0803 100644 --- a/Spew.lua +++ b/Spew.lua @@ -96,7 +96,7 @@ function Spew(input, a1, ...) table.sort(sorttable, downcasesort) for _,i in ipairs(sorttable) do local v, output = a1[i] - if type(v) == "function" and type(i) == "string" and not blist[i] and (i:find("^Is") or i:find("^Can") or i:find("^Get")) then + if type(v) == "function" and type(i) == "string" and not blist[i] and ((i:find("^Is") and i ~= "IsUnit") or i:find("^Can") or i:find("^Get")) then output = pcallhelper(pcall(v, a1)) end if output then Print(" |cff7fd5ff"..tostring(i).."|r => "..output) From 97953e1be057fc38aa146e7fa323bd0566649537 Mon Sep 17 00:00:00 2001 From: Ketho Date: Tue, 26 Jul 2022 00:40:28 +0200 Subject: [PATCH 3/3] Additional IsForbidden check --- Spew.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Spew.lua b/Spew.lua index a6a0803..30e9542 100644 --- a/Spew.lua +++ b/Spew.lua @@ -1,4 +1,4 @@ - +---@diagnostic disable: undefined-field, unbalanced-assignments local myname, ns = ... local TABLEITEMS, TABLEDEPTH = 5, 1 @@ -88,7 +88,7 @@ function Spew(input, a1, ...) if type(a1) == "table" then if type(rawget(a1, 0)) == "userdata" and type(a1.GetObjectType) == "function" then -- We've got a frame! - if a1:IsForbidden() then Print("|cffff0000