View Single Post
08-29-08, 04:49 PM   #2
Tenge
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 9
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.

* 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!
Attached Files
File Type: lua Core.lua (12.2 KB, 686 views)

Last edited by Tenge : 08-29-08 at 05:31 PM. Reason: Typo, and added Blizzard quote
  Reply With Quote