WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   If you need help debugging... (https://www.wowinterface.com/forums/showthread.php?t=17642)

LBXZero 08-10-08 08:13 AM

If you need help debugging...
 
If anyone is having problems in WotLK, I am open to assist in solving those bugs or problems. It seems to be one of my best talents.

I only have a 70 mage on Northend.

Tenge 08-29-08 04:49 PM

1 Attachment(s)
I posted this over on the official UI forum, but I figure I might find more direcxt answers here, especially if you're proficient with forum code debugging too, Zero.


I started maintaining the Visor2 addon a few years ago for the TBC release, and being very much a Lua novice and not knowing any better, I kept the global-args pattern that it was using (which I've discovered is rather antiquated =).

So fast forward to the present, and I'm finally getting around to updating this addon for the 3.0 Beta and discovered that the "self.args" reference the code has been using (see below) is now coming up as "nil" in Beta and throwing an error.

I'm assuming this related primarily to the blizzard changes quoted below, but the way I'm implementing the arg's seems to be an equal contributor to the problem.

Quote:

* The blizzard UI is being converted to use 'self' and the other local arguments in favor of 'this' and argN. The old style arguments are going to be obsoleted, so AddOn code needs to be updated too. This may mean there are changes in the signatures of Blizzard UI functions - update code that hooks or replaces the blizzard UI where necessary as well. !!!
Here's what the code looks like now (attached Core.lua as well):

Code:

local options = {
        type='group',
        args= {
                detail = {
                        type = 'text',
                        name = 'Detail',
                        desc = "Displays all of Visor2's settings for the frame.",
                        usage = "list|<frame name>",
                        get = false,
                        set = "DetailedReport",
                        order = 1,
                },
                set = {
                        type = 'text',
                        name = 'Set',
                        desc = "The core command within Visor2.  See '/vz help' for details.",
                        usage = "<options>",
                        get = false,
                        set = "SetupFrame",
                        order = 2,
                },
etc...

And here's the part where the error occurs (it's saying that self.args = nil, and is expecting a table of course):

Code:

        for _, v in pairs(self.args) do
                if p[v] then np = true end
        end


So essentially, I'm wondering if anyone has a quick reference or in-code example of the new/proper way to implement addon arg's these days... specifically within the Ace2 or Ace3 framework, but any tips are appreciated.

Edit2:

The more I familiarize myself with the code again, I'm probably confusing the "args" sub-table within the global "options" table (see the code in my last post), with the "self.args" variable. I'm starting to think they're two separate entities, so I'll have to dig a bit deeper.

I just thought of something else as well... need to double-check that I have the latest set of Ace2 libs that are WotLK compatible. I'll d/l and test a bit further when I get home this evening. The "self.args" is likely defined and manipulated within the framework.

Thanks!

rodrick 08-29-08 06:37 PM

try options.args

The problem is I don't see what self is set to or what function that code block is in. Regardless if you only have one options table, and it's local to the file that your code block is in you should be able to access it via options.args. If it still comes up nil then either it's being nil'd out before that code is ran or it's a scope problem.

rodrick 08-29-08 06:39 PM

Actually the more I think this over the more I'm confused as to what you are trying to do . . . if just updating to the WoLK compatible branch of the Ace2 libs doesn't fix it then PM me the entire file so I can look through it and look for scope, etc.

Tenge 08-30-08 09:03 PM

Turns out I goofed when updating to the WotLK-capable Ace2 libraries.
Grabbed the correct ones earlier today, and things are working fine now.

LBXZero 08-31-08 11:48 AM

That is good. I was waiting to reply until after I seen the problem for myself, but I first had to update my beta client, and then find time between work. (Want to hunt down co-worker that quit.)


All times are GMT -6. The time now is 03:05 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI