mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-22 20:10:50 +00:00
api: reduce memory load in HookScript call
This commit is contained in:
+6
-3
@@ -310,12 +310,15 @@ function pfUI.api.hooksecurefunc(name, func, append)
|
|||||||
_G[name] = pfUI.hooks[tostring(func)]["function"]
|
_G[name] = pfUI.hooks[tostring(func)]["function"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- [ HookScript ]
|
||||||
|
-- Sets a function to be called automatically after the original function is called
|
||||||
|
-- 'f' [frame] the frame that should get a function hook
|
||||||
|
-- 'script' [string] the name of the function that should be hooked
|
||||||
|
-- 'func' [function] the function that should run after the original one
|
||||||
function pfUI.api.HookScript(f, script, func)
|
function pfUI.api.HookScript(f, script, func)
|
||||||
local prev = f:GetScript(script)
|
local prev = f:GetScript(script)
|
||||||
|
f:SetScript(script, function()
|
||||||
f:SetScript(script, function(...)
|
|
||||||
if prev then prev() end
|
if prev then prev() end
|
||||||
|
|
||||||
func()
|
func()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user