compat: allow table hooks in hooksecurefunc

This commit is contained in:
shagu
2025-07-30 19:52:38 +02:00
parent cac46531f8
commit e5c2d08fbe
+8 -4
View File
@@ -34,11 +34,15 @@ ACTIONBAR_SECURE_TEMPLATE_BUTTON = nil
UNITFRAME_SECURE_TEMPLATE = nil
--[[ Vanilla API Extensions ]]--
function hooksecurefunc(name, func, append)
if not _G[name] then return end
function hooksecurefunc(tbl, name, func, append)
if type(tbl) == "string" then
append, func, name, tbl = func, name, tbl, _G
end
if not tbl or not tbl[name] then return end
pfUI.hooks[tostring(func)] = {}
pfUI.hooks[tostring(func)]["old"] = _G[name]
pfUI.hooks[tostring(func)]["old"] = tbl[name]
pfUI.hooks[tostring(func)]["new"] = func
if append then
@@ -53,7 +57,7 @@ function hooksecurefunc(name, func, append)
end
end
_G[name] = pfUI.hooks[tostring(func)]["function"]
tbl[name] = pfUI.hooks[tostring(func)]["function"]
end
do -- GetItemInfo