Originally Posted by Spyro
Hi guyz.
Lua Code:
local function GetThreatRegion(Plate) return select(1, (Plate:GetChildren()):GetRegions()) end TheNameplate:SetScript("OnShow", function(Plate) GetThreatRegion(Plate):SetVertexColor(0, 1, 0, 1) GetThreatRegion(Plate):Show() )
|
What are you passing to 'GetThreatRegion()'?
If 'TheNameplate' is a stock UI nameplate, is SetScript not a bit dangerous? HookScript does the same as SetScript if no function already exists for the handler in question with the added bonus of not inadvertently removing the script set by Blizz (or another addon). If it's your own nameplate, sorry for misunderstanding.
In your example, is 'TheNameplate' the same object as 'Plate'? If so...
Lua Code:
local nameplate = ?;
nameplate:HookScript("OnShow", function(self)
GetThreatRegion(self):SetVertexColor(0, 1, 0, 1);
GetThreatRegion(self):Show();
)
If it were me, I'd use print to test the code to make sure you're on the right track. Notably, I'd definitely check the return value of GetThreatRegion().
Lua Code:
print( select( 1, (nameOfNameplate:GetChildren()):GetRegions() ) );
I'm not sure, but using the first return from GetRegions (from the first return of GetChildren) seems a bit off.