mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
update HookScript function
This commit is contained in:
@@ -82,21 +82,19 @@ QuestDifficultyColors = {
|
|||||||
["header"] = {r = 0.70, g = 0.70, b = 0.70}
|
["header"] = {r = 0.70, g = 0.70, b = 0.70}
|
||||||
}
|
}
|
||||||
|
|
||||||
function HookScript(frame, scriptType, handler)
|
function HookScript(frame, scriptName, handler)
|
||||||
if not (type(frame) == "table" and frame.GetScript and type(scriptType) == "string" and type(handler) == "function") then
|
if not (type(frame) == "table" and frame.GetScript and type(scriptName) == "string" and type(handler) == "function") then
|
||||||
error("Usage: HookScript(frame, \"type\", function)", 2)
|
error("Usage: HookScript(frame, \"type\", function)", 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local original_scipt = frame:GetScript(scriptType)
|
local original_scipt = frame:GetScript(scriptName)
|
||||||
if original_scipt then
|
if original_scipt then
|
||||||
frame:SetScript(scriptType, function(...)
|
frame:SetScript(scriptName, function()
|
||||||
local original_return = {original_scipt(unpack(arg))}
|
original_scipt(this)
|
||||||
handler(unpack(arg))
|
handler(this)
|
||||||
|
|
||||||
return unpack(original_return)
|
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
frame:SetScript(scriptType, handler)
|
frame:SetScript(scriptName, handler)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user