Go Back   WowAce Forums > General > Lua Code Discussion
Lua Code Discussion You scared? Terrified. Mortified. Petrified. Stupefied... by [coding].

Reply
 
Thread Tools
Old 03-21-2010   #1
evilchookie
Newbie
 
evilchookie's Avatar
 
Join Date: Sep 2008
Posts: 3
Default Working with AceConsole-3.0

I'm starting out writing my own Ace3 Addon. Having written software in other languages, I figured this would be a sinch. However, it doesn't seem that way.

I have included all the Ace3-Libs, as described in the WelcomeHome tutorial. Mine is called AddonChecker, and here's the lua in AddonChecker.lua.

I have included the same embeds.xml as in the example I linked above, and I have also ensured that all of those files are in the libs folder.

Code:
AddonChecker = LibStub("AceAddon-3.0"):NewAddon("AddonChecker","AceConsole-3.0")

function AddonChecker:OnInitialize()
    DEFAULT_CHAT_FRAME:AddMessage("Addon Checker Loaded")
    AddonChecker:RegisterChatCommand("ac", "DoCheck")
    AddonChecker:RegisterChatCommand("addonchecker", "DoCheck")
end
I'm receiving the following error from BugGrabber when I load / reload my UI:

Code:
1x AddonChecker-0.1\AddonChecker.lua:4: Usage: EmbedLibrary(addon, libname, silent, offset): 'libname' - Cannot find a library instance of "AceConsole-3.0".
AceAddon-3.0-5 (AddonChecker):209: in function `EmbedLibrary'
AceAddon-3.0-5 (AddonChecker):191: in function `EmbedLibraries'
AceAddon-3.0-5 (AddonChecker):158: in function `NewAddon'
AddonChecker-0.1\AddonChecker.lua:4: in main chunk
Obviously, it can't find AceConsole-3.0. But I can confirm it's where it should be, and my embeds.xml is pointing to it. What other simple yet not quite obvious things could cause such an error?

Thanks in advance, and let me know if I need to provide more information (or I threw this in the wrong place).
evilchookie is offline   Reply With Quote
Old 03-21-2010   #2
Slakah
Senior Member
 
Slakah's Avatar
 
Join Date: Jul 2007
Posts: 387
Default Re: Working with AceConsole-3.0

Have you included embeds.xml in your toc, and is it above the main lua file?
Slakah is offline   Reply With Quote
Old 03-21-2010   #3
evilchookie
Newbie
 
evilchookie's Avatar
 
Join Date: Sep 2008
Posts: 3
Default Re: Working with AceConsole-3.0

Thanks for the reply. I sure have, and just to make sure I'm not missing something, here are the contents of those files:

AddonChecker.toc

Code:
## Interface: 30300
## Title: AddonChecker
## Author: Xervish
## Version: 0.1
## Notes: Checks Raid Members for essential addons. By Xervish of Norgannon.
## Dependencies:
embeds.xml
AddonChecker.lua
embeds.xml:

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
    <Script file="Libs\LibStub\LibStub.lua"/>
    <Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
    <Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml"/>
    <Include file="Libs\AceGUI-3.0\AceGUI-3.0.xml"/>
    <Include file="Libs\AceConfig-3.0\AceConfig-3.0.xml"/>
    <Include file="Libs\AceConsole-3.0\AceConsole-3.0.xml"/>
    <Include file="Libs\AceDB-3.0\AceDB-3.0.xml"/>
    <Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/>
</Ui>
evilchookie is offline   Reply With Quote
Old 03-22-2010   #4
myrroddin
Amazing Member
 
Join Date: May 2006
Location: Edmonton, Canada
Posts: 1,143
Send a message via MSN to myrroddin
Default Re: Working with AceConsole-3.0

Put AceGUI after AceConsole and AceConfig, as it depends on those being loaded first. I may be wrong, but the pattern seems alphabetized for load order.
myrroddin is offline   Reply With Quote
Old 03-22-2010   #5
Phanx
Seal Cub Clubbing Club
 
Phanx's Avatar
 
Join Date: May 2005
Location: United States
Posts: 8,104
Default Re: Working with AceConsole-3.0

That's actually incorrect. AceConfig depends on AceConsole and AceGUI, not the other way around, and neither AceConsole nor AceGUI depend on anything themselves.

If you're confused about the load order of Ace3 libs, just look in the .toc for the standalone Ace3 package. As per that, the correct load order is:
Code:
AceAddon-3.0
AceEvent-3.0
AceTimer-3.0
AceBucket-3.0
AceHook-3.0
AceDB-3.0
AceDBOptions-3.0
AceLocale-3.0
AceConsole-3.0
AceGUI-3.0
AceConfig-3.0
     AceConfigRegistry-3.0
     AceConfigCmd-3.0
     AceConfigDialog-3.0
AceComm-3.0
AceTab-3.0
AceSerializer-3.0
Your specific problem is (probably) that you're loading AceConfig before AceConsole.

Also, there is no longer any useful reason to have an embeds.xml file. The original purpose of this file was to reduce loading time for standalone library users (since referencing nonexistent files in a .toc file adds significantly to loading times, but referencing them in an .xml file does not), but that purpose was nullified in August 2008 when WowAce joined Curse and did away with the old files.wowace.com packager and WowAceUpdater program. Nowadays it actually increases load time (since it adds an extra file to be read from disk) and adds needless complexity. You should just reference your libs from the .toc file, and (if you're using a WowAce/CurseForge repository) surround them with the appropriate no-lib-strip tags for the packager.
__________________
Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge
Troubleshoot an addon | Turn any code into an addon | More addon resources
Need help with your code? Attach or paste your whole, real files.
Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead!

Last edited by Phanx; 03-22-2010 at 01:46 AM.
Phanx is offline   Reply With Quote
Old 03-22-2010   #6
evilchookie
Newbie
 
evilchookie's Avatar
 
Join Date: Sep 2008
Posts: 3
Default Re: Working with AceConsole-3.0

Quote:
Originally Posted by Phanx View Post
Your specific problem is (probably) that you're loading AceConfig before AceConsole.
Champion!

Putting my includes in the rough order that you mentioned did the trick. Also, thanks for the heads up regarding the redundancy of embeds.xml - I'll end up including the libraries directly in the .toc file.

Thanks again!
evilchookie is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

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

Forum Jump


All times are GMT. The time now is 11:50 AM.