How can i hook complex Blizz functions, like: Module:FuncName(arguments)?
I would like to SetJustifyH "CENTER" all ObjectiveTrackerBlocks and remove all "Dashes" as well. I'm talking about Blocks that contains information about Quests you currently track:
(Sorry for different language on screenshot)
Files that respond to this frames locates in Interface\AddOns\Blizzard_ObjectiveTracker\ folder.
There are lots of files in this folder, but I think most relevant is this: Blizzard_ObjectiveTracker.lua (link to wowprogramming.com)
There are lot's of complex functions that I had never worked before. For example:
function DEFAULT_OBJECTIVE_TRACKER_MODULE:SetHeader(block, text, animateReason)
block.module = self;
block.animateReason = animateReason or0;
self.Header = block;
I tried to investigate more information about this functions and how they works, and for me (person who never programmed before, it's pretty hard to instantly understand them, but i would like).
On Hooking Functions Guide I read that it's possible to hook this strange functions. This Guide gives this example:
--[[Functions called using the object calling syntax, object:method(...), can also be hooked; one simply has to remember that the construct is merely syntactic sugar for object.method(object, ...);. To hook a function that was originally declared as:]]
-- Things happen here...
--[[We store the original function and replace it with a hook:]]
local original_AnAddon_Module_FuncName = AnAddon.Module.FuncName;
local arg1 = ...;-- Use the vararg expression in case the function signature changes
iftype(arg1)=="number"and arg1 >0then
-- Call the original function; because of object calling syntax,
But it looks like that i'm doing something wrong. I don't get any lua errors, but no print("TEST") as well, so it's not hooked.
I will very appreciate if you could help me with example of how can i hook this complex functions or with advice or ideas how can i SetJustifyH("CENTER") and remove Dash without hooking this crazy functions (Names of ObjectiveTrackerBlocks are dynamic: example on screenshot)