/trunk/Libs/AceHook-3.0
-- make into AceHook. |
-- @class file |
-- @name AceHook-3.0 |
-- @release $Id: AceHook-3.0.lua 1064 2012-09-04 17:14:01Z nevcairiel $ |
local ACEHOOK_MAJOR, ACEHOOK_MINOR = "AceHook-3.0", 6 |
-- @release $Id: AceHook-3.0.lua 1118 2014-10-12 08:21:54Z nevcairiel $ |
local ACEHOOK_MAJOR, ACEHOOK_MINOR = "AceHook-3.0", 8 |
local AceHook, oldminor = LibStub:NewLibrary(ACEHOOK_MAJOR, ACEHOOK_MINOR) |
if not AceHook then return end -- No upgrade needed |
if not obj or not obj.GetScript or not obj:HasScript(method) then |
error(format("%s: You can only hook a script on a frame object", usage), 3) |
end |
if not secure and obj:IsProtected() and protectedScripts[method] then |
if not secure and obj.IsProtected and obj:IsProtected() and protectedScripts[method] then |
error(format("Cannot hook secure script %q; Use SecureHookScript(obj, method, [handler]) instead.", method), 3) |
end |
else |
end |
if script then |
-- If the script is empty before, HookScript will not work, so use SetScript instead |
-- This will make the hook insecure, but shouldnt matter, since it was empty before. |
-- It does not taint the full frame. |
if not secure or orig == donothing then |
if not secure then |
obj:SetScript(method, uid) |
elseif secure then |
else |
obj:HookScript(method, uid) |
end |
else |