Thread Tools Display Modes
08-21-10, 11:29 AM   #1
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
How do I embedd an addon?

I want to create my own suite, such as TukUI. He's inspired me a lot by his own UI, and it feels like it'd be a fun project to have.

I've run into a problem right off the bat though, how the flippin' fudge do I embedd oUF into my !blablaUI addon? As far as I can see from scanning Tukz github files I'm doing nothing wrong, every module so far loads except oUF, and I get an error that my layout couldn't find "global oUF" when creating a tag.

I've basically just dropped oUF into an "embedd" folder and then added it's oUF.xml to my own .toc file. I don't see what I'm doing wrong though.

I can throw up my !blablaUI addon folder if needed.

Thanks for help in advance!
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote
08-21-10, 11:39 AM   #2
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Do you have the oUF global specified in the .toc?

## X-oUF: oUF

Tukui.toc does it this way.

EDIT: You may also use the oUF in the namespace, without any global at all.
Code:
local parent, ns = ...
local oUF = ns.oUF
__________________
« Website | GitHub »

Oh hai!

Last edited by xConStruct : 08-21-10 at 11:43 AM.
  Reply With Quote
08-21-10, 11:43 AM   #3
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Originally Posted by Cargor View Post
Do you have the oUF global specified in the .toc?

## X-oUF: oUF

Tukui.toc does it this way.
I added it, but I was ingame and I just reloaded. Quite sure I have to restart WoW for changes to the .toc file. Brb!

EDIT: Right, it worked now. All of a sudden a new error shows up but I can solve this myself I think.
Thanks Cargor! I feel really stupid now.

EDIT2: I spoke too quickly, seems the error I got blocked this error from happening, or something. It still can't find "global oUF". I'll post the whole error here.

Code:
Message: Interface\AddOns\!haoriUI\unitframes\Layout.lua:55: attempt to index global 'oUF' (a nil value)
Time: 08/21/10 19:45:57
Count: 1
Stack: Interface\AddOns\!haoriUI\unitframes\Layout.lua:55: in main chunk
The code for my "!haoriUI" can be found here, well, a download to the entire addon since there are a few files and the embedd etc. Too lazy to get a github up yet.
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 08-21-10 at 11:49 AM.
  Reply With Quote
08-21-10, 11:53 AM   #4
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
You should load oUF in your xml-file before your oUF layout
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-21-10, 11:56 AM   #5
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Originally Posted by Cargor View Post
You should load oUF in your xml-file before your oUF layout
Doh! Trying this!

EDIT: Same error. :/
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote
08-21-10, 12:19 PM   #6
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Got an svn thing set up to view my code easier, no download required anymore.

http://code.google.com/p/haori-ui/so...trunk/!haoriUI

Still isn't working, it's probably some retardedly stupidly small, easy thing that I'm missing.
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote
08-21-10, 12:24 PM   #7
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Hmm, I don't see any mistakes. Maybe you could add a print() on top of oUF.lua to see if it actually gets loaded.
And try if the namespace-oUF is available as I posted above.

Maybe this helps to narrow down the error
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-21-10, 12:34 PM   #8
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Originally Posted by Cargor View Post
Hmm, I don't see any mistakes. Maybe you could add a print() on top of oUF.lua to see if it actually gets loaded.
And try if the namespace-oUF is available as I posted above.

Maybe this helps to narrow down the error
I'll add a print, I don't know what this namespace thing is and how/where to add it though. :/

EDIT: The print implies oUF is loading, I've not tried the namespace thing yet as I don't know how it works. I now get an error from oUF in the chat frame, saying:
"oUF: Error: !haoriUI is doing it wrong and settings its global to oUF."
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 08-21-10 at 12:37 PM.
  Reply With Quote
08-21-10, 12:42 PM   #9
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Ah, well, at the top of your file. These namespaces are some compromise between global and local variables - think 'local to your addon'.

Each file of your addon gets delivered some arguments via "...":
#1: the name of the addon (here 'parent')
#2: a table specific to your addon (the 'namespace').

oUF normally does the same thing and then adds itself to the namespace-table, so you can access it via 'ns.oUF" even if you don't have a global defined.

---
@your global-'error': Then go the namespace-route and remove the global, it's probably better this way. I wonder if the message comes in TukUI too or if he patched it out.

EDIT: with 'file' I mean each file which uses oUF, so: your layout :P
__________________
« Website | GitHub »

Oh hai!

Last edited by xConStruct : 08-21-10 at 12:44 PM. Reason: clarification
  Reply With Quote
08-21-10, 12:47 PM   #10
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
I can't really remove the global from my layout, since the error fires on "oUF.Tags" - Where I create a health display for my unitframe.

So I would add
Code:
local parent, ns = ...
local oUF = ns.oUF
to the top of my layout file?

EDIT: I don't even know what I'm trying to say here. Re-read your post and it makes a little more sense now, I just don't know how to go about doing this. Where do I add the 2 lines of code seen above and should I do "ns.oUF.Tags" later instead?
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 08-21-10 at 12:51 PM.
  Reply With Quote
08-21-10, 12:51 PM   #11
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Yep.

(10 character limit)
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-21-10, 12:55 PM   #12
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
It works now, but the chat error remains. I'll stick with it for now and when I'm more experienced with this I'll patch it out.

Thanks a bunch Cargor!
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote
08-21-10, 01:01 PM   #13
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
The global-part is located at the bottom of ouf.lua:

Code:
if(global) then
	if(parent ~= 'oUF' and global == 'oUF') then
		error("%s is doing it wrong and setting its global to oUF.", parent)
	else
		_G[global] = oUF
	end
end
So, it errors out if you register it as a global 'oUF', but your addon is not oUF. Either remove the X-oUF-part in your .toc (it's no longer needed with namespaces) or choose a different global name, e.g.:
"x-oUF: My_oUF" would store oUF in "My_oUF".
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-21-10, 02:00 PM   #14
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Removing it then, thanks a bunch Cargor. I really appreciate the help!
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How do I embedd an addon?


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