diff --git a/compat/vanilla.lua b/compat/vanilla.lua index 0cc4485f..2dad05aa 100644 --- a/compat/vanilla.lua +++ b/compat/vanilla.lua @@ -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