Quantcast
WoWInterface - View Single Post - How could this be written neater?
View Single Post
05-07-17, 07:08 PM   #5
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Hi MunkDev,

Your example is awesome !!!!

Originally Posted by MunkDev View Post
(1) You're doing checkups on tables that may not exist. If you don't intend to add tables for every class and spec, anyone else using your addon that is not a destruction warlock will get errors.
You are right! It was to show my intention of this addon and id for each class and spec are not listed there, yet

If possible, I am planning to create an interface options panel to add the id for each class and spec.

Originally Posted by MunkDev View Post
(2) What's the point in your holder frame and not just using the AuraTrack frame you already created to show your auras?
Sorry for the lacking explanation.

The actual project uses Ace3.0 and AuraTrack in that case is actually an addon of Ace3.0 (not frame).

I totally forgot to clarify regarding that

Originally Posted by MunkDev View Post
(3) You don't need to upvalue the global environment just to grab a few functions. This process is quick and painless and only happens once on login anyway.


Originally Posted by MunkDev View Post
(4) Unless there's a specific reason why you're using a set max of 6 auras, you can use a frame factory / frame pool to spawn your trackers instead of creating them on load. I'll show you an example of how this works with the native implementation already in the UI.
There was no specific reason to lock max frame to 6, but I was just trying to match its width to one of my center bar

In the future, if I want to limit the max frame to 6, I guess I could just put if statement at the top of :UNIT_AURA() function, am I right?

Code:
function AuraTrack:UNIT_AURA(...)
	if self.numTotalObjects >= 6 then
		return;
	end

	-- rest of your code
end


I have skimmed through the APIs and there are new terms (and functions) in your example that I am not familiar with.
  • Mixin
  • ObjectPoolMixin
  • :OnLoad()
  • :ReleaseAll()
  • :Acquire()

So, you are inheriting ObjectPoolMixin's functions to AuraTracker via Mixin which are OnLoad, ReleaseAll and Acquire, right?

Learning new stuff is always exciting

*EDIT: Guess I found a reference here

*EDIT2: Are there any other good Mixin that is good to know with?

Last edited by Layback_ : 05-07-17 at 07:57 PM.
  Reply With Quote