If :SetHidden(true) is your solution but something calls again :SetHidden(false) to revert your solution then you need to replace SetHidden by your function to filter out the calls made to SetHidden with false
In the sample I show you how to replace the SetHidden function by yours so you can decide then to pass the original execution to origZO_PlayerAttributeHealthBarLeftGloss to have the result of a normal SetHidden, or to not continue the execution , that's how you can forbid any call made to SetHidden
It is not specific to Lua, it is just called function hooking and is present in all the programming language, the only requirement is overwrite the pointer of the original function by your and to store a pointer of the original function in a local variable before you replace it so you can call later the original function from your.
Lua Code:
local originalSetHiddenLeft = ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
local originalSetHiddenRight = ZO_PlayerAttributeHealthBarRightGloss.SetHidden
local function newSetHiddenLeft(self, hidden, ...)
if hidden == false then
--do nothing, meaning, SetHidden is disabled
return
end
originalSetHiddenLeft(self, hidden, ...) -- Calls the normal ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
end
local function newSetHiddenRight(self, hidden, ...)
if hidden == false then
--do nothing, meaning, SetHidden is disabled
return
end
originalSetHiddenRight (self, hidden, ...) -- Calls the normal ZO_PlayerAttributeHealthBarRightGloss.SetHidden
end
ZO_PlayerAttributeHealthBarLeftGloss.SetHidden = newSetHiddenLeft
ZO_PlayerAttributeHealthBarRightGloss.SetHidden = newSetHiddenRight