View Single Post
04-22-09, 10:55 PM   #999
Dimpf
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 25
I have a question about how Lua and oUF work in general, I suppose.

I'm concerned about optimizing my layout, and the necessity of doing so. Does Lua parse through the layout and create the frame object each time I target someone, or the ToT changes?

Or, does it only parse it once, create the object, and update it when it changes?

In the first case, doing something like this would be very bad, but it makes for clean readable code:

Code:
self.Health = CreateFrame"StatusBar"
self.Health:SetParent(self)
if (unit == 'player') then
	self.Health:SetWidth(playerHPWidth)
	self.Health:SetHeight(playerHPHeight)
	self.Health:SetPoint("BOTTOM", 0, 12)
	self.Health:SetPoint("LEFT", self.Portrait, "RIGHT", 1, 0)
elseif( unit == 'target') then
	self.Health:SetWidth(playerHPWidth)
	self.Health:SetHeight(playerHPHeight)
...and so on.

I'm hoping it's the latter case.