Thread Tools Display Modes
07-17-14, 06:15 AM   #21
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
What do you need Unit1 for? Do you really need that as part of the global scope?
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
07-17-14, 06:49 AM   #22
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
Originally Posted by zork View Post
What do you need Unit1 for? Do you really need that as part of the global scope?
part of the visual layout
for just visualizing
__________________
  Reply With Quote
07-17-14, 09:11 AM   #23
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Originally Posted by Phanx View Post
Even though you don't want to use the oUF framework, its highly modular nature means it's a good place to look to see which events and functions are related to what:

https://github.com/haste/oUF/tree/master/elements

For example, if you want to see which events you should listen to, and which functions you should call, to display and update the unit's health, just look in the health module:

https://github.com/haste/oUF/blob/ma...nts/health.lua

I'd recommend this over the default UI code, since while the default UI obviously works, it's generally not a good example of well-written Lua code, and any complex systems (unit frames, for example) are extremely disorganized, with one part over here in this file, one part over there in that file, three parts up here, one part down there, etc.

API references are also your friend, but won't give you as much of a sense of what you need for a specific task.
Thanks, for me I am just learning from bare bones. Then I will probably try my hand at a oUF layout. I like to understand the foundation.
  Reply With Quote
07-17-14, 09:39 AM   #24
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
Originally Posted by rocnroll View Post
Thanks, for me I am just learning from bare bones. Then I will probably try my hand at a oUF layout. I like to understand the foundation.
im mostly bare bones basic too
so bad as this
oUF installed and chk-marked
oUF layout sqwUnitframes installed and chk'd
start game.....
NOTHIN
any suggestions?
__________________
  Reply With Quote
07-17-14, 10:57 AM   #25
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Uitat View Post
im mostly bare bones basic too
so bad as this
oUF installed and chk-marked
oUF layout sqwUnitframes installed and chk'd
start game.....
NOTHIN
any suggestions?
Start a separate thread for your oUF layout questions. If it's your own layout, post your code. If it's not your own layout, post more information (eg. where did you download oUF from? where did you download the layout from? did you try without other addons enabled? etc.) and see the troubleshooting link in my signature.

Originally Posted by zork View Post
What do you need Unit1 for? Do you really need that as part of the global scope?
Originally Posted by Uitat View Post
part of the visual layout
for just visualizing
His point was that you're using "Unit1" as a global name for that frame. In general, you should avoid giving global names to things unless they actually need to have them. Frames using Blizzard templates (eg. unit frames) do need global names. Generic frames used to assist in layouts do not need global names. And when you do give something a global name, make sure that name meets these two critera:

(1) The name is unique. Generic names like "Unit1" are bad because the probability of other addons using the same name is fairly high. If two addons both define a global "Unit1" then one overwrites the other, and one or both addons might break.

(2) The name clearly identifies which addon the object belongs to, and what the object's purpose is, so that if it appears in an error message, the user knows which addon to blame, and if they are using "/fstack" it's obvious where they should look for options to move or hide the frame.

Here, you can name your individual unit frames eg. "UitatPlayerFrame", "UitatTargetFrame", etc. and this will solve both problems. And if the "Unit1" frame is meant to contain all the unit frames, then a name like "UitatBackground" would be a better choice -- it's unique, it clearly identifies the addon, and it clearly describes the frame's purpose -- if you really want it to have a global name at all.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
07-17-14, 11:18 AM   #26
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
Originally Posted by Phanx View Post
Start a separate thread for your oUF layout questions.......
as for the oUF
i think he hasn't updated it in a while or something, i tested out yours and it activated perfectly.

time for a rewrite of what i have on the UnitFrames, i agree, very bad idea on the global "Unit1" musta been tired or stupid or something.. again you not only proove me a fool but give me impoortant lessons i wont soon forget!!

thank you Zork and Phanx!!!
a good slap in the head goes a long way hahaha
__________________
  Reply With Quote
07-17-14, 12:39 PM   #27
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Uitat View Post
as for the oUF
i think he hasn't updated it in a while or something, i tested out yours and it activated perfectly.
http://www.wowinterface.com/downloads/info9994-oUF.html

You can get alpha versions on GitHub:
https://github.com/haste/oUF

...but currently there are no significant changes since the last release on WoWI. The latest release version on WoWI should work just fine with current layouts.

However, based on the comments on the sqwUnitframes page:
http://www.wowinterface.com/download...nitframes.html

...the layout is not compatible with the latest oUF versions, so if you want to use it, you should use the version of oUF that's bundled in the layout, and remove any separately-installed copy of oUF.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Unit Frames

Thread Tools
Display Modes

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