Thread Tools Display Modes
Prev Previous Post   Next Post Next
11-05-13, 06:20 AM   #1
skarie
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2011
Posts: 37
self.bugged

Hi all,

I am new to this oUF thing and need your help on this matter. I am trying to store a variable in self and to change it using PostUpdateHealth. But for some reason, I cant seem to make it work. Pls look at codes below:

--[[my postupdatehealth]]--
Code:
local PostUpdateHealth = function(Health, unit, min, max)
  local self = Health:GetParent()
  self.Ptext:SetText("b") -- <----self.Ptext is always nil ???????
end
--[[ init is called for every unit frame ]]--
Code:
local function init(self)
	self:RegisterForClicks('AnyUp')
	self:SetScript('OnEnter', UnitFrame_OnEnter)
	self:SetScript('OnLeave', UnitFrame_OnLeave)

	local Ptext = self:CreateFontString(nil,"OVERLAY")
	Ptext:SetFont( "Interface\\AddOns\\oUF_HL2\\ghostsmileys.ttf", 72, "OUTLINE")
	Ptext:SetTextColor(0.81, 0.86, 0.77)
	Ptext:SetText("a")
	self.Ptext = Ptext -- <---trying to store self.Ptext here.

end
--[[ target frame ]]--
Code:
local function CreateTarget(self)
   init(self) --
   --[[ omit codes to create Health.... etc]]
   self.Ptext:SetPoint("CENTER",self,"CENTER") -- <---self.Ptext is ok here 
   self.Health = Health
   self.Health.PostUpdate = PostUpdateHealth
end
I am getting an error saying self.Ptext is undefined. What do I miss? Do I need to change PostUpdateHealth() also to make it work?
  Reply With Quote
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » self.bugged


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off