Originally Posted by Sasky
Lua Code:
local d_old = d d = function(...) end zo_callLater(function() d = d_old end, 2000)
|
It is not a good idea to restore function from backup, because you never know if any other addon hooks the same function after your addon is loaded.
Method used by thelegendaryof's BugEater is better.
Lua Code:
local ignore = true
ZO_PreHook("d", function() return ignore end)
EVENT_MANAGER:RegisterForEvent("Debug_Hook", EVENT_PLAYER_ACTIVATED,
function(event)
zo_callLater(function() ignore = false end, 250)
EVENT_MANAGER:UnregisterForEvent("Debug_Hook", event)
end)
EDIT:
I have to say that instead of hooking d(), it is better to use code provided by Fathis Ules. It works even if addon uses different method of displaying of chat "spam":
Lua Code:
EVENT_MANAGER:RegisterForEvent("Clear_Chat", EVENT_PLAYER_ACTIVATED,
function(event)
zo_callLater(
function()
for i = 1, #ZO_ChatWindow.container.windows do
if _G["ZO_ChatWindowTemplate"..i.."Buffer"] then _G["ZO_ChatWindowTemplate"..i.."Buffer"]:Clear() end
end
end, 250)
EVENT_MANAGER:UnregisterForEvent("Clear_Chat", event)
end)