Loading...

[ELVUI-EXTERNAL] Unable to hook PostUpdateHealth

1
Hi,

I'm a total newbie in Lua Script coding... I'll try to explain what I want to achieve.
Here is my current code:

Code: Select all

local E = unpack(ElvUI) -- import: Engine
local UF = E.UnitFrames -- ElvUI's UnitFrames
local EMOSA = E:NewModule("EMOSA") -- this AddOn

function EMOSA:HealthGradient(frame, bg, text, textPos)
    print("YEAH !!!")
end

function EMOSA:Initialize()
    print('YEAH !!')
	hooksecurefunc(UF, "PostUpdateHealth", EMOSA.HealthGradient)
end

local function InitializeCallback()
    print('YEAH !')
	EMOSA:Initialize()
end

E:RegisterModule(EMOSA:GetName(), InitializeCallback)
PostUpdateHealth method seems not reachable at this point. When I try to hook Update_StatusBars then it works.
But I want to add some gradient to my healthbar, like this one which I've made with Weakaura :
Image
Can you just guide me for the first few steps?

Regards,
Mosa