All right, thanks for the clarification! Now I understand the difference between SetScript and HookScript. :-D
However, if other Addons use the same method as you suggested, I have again no controll over which one is loaded first, right?
E.g. the author of
LibExtraTip (used by
TheUndermineJournal) does it like this (LibExtraTip.lua, L545):
Lua Code:
-- Called to install/modify a pre-hook on the given tooltip's event
-- Currently we do not need any posthooks on scripts
local function hookscript(tip, script, prehook)
if not lib.hookStore[tip] then lib.hookStore[tip] = {} end
local control
-- check for existing hook
control = lib.hookStore[tip][script]
if control then
control[1] = prehook or control[1]
return
end
-- prepare upvalues
local orig = tip:GetScript(script)
control = {prehook}
lib.hookStore[tip][script] = control
-- install hook stub
local stub = function(...)
local h
-- prehook
h = control[1]
if h then h(...) end
-- original hook
if orig then orig(...) end
end
tip:SetScript(script, stub)
end
With your code, my lines always get appended after those of TheUndermineJournal.