View Single Post
12-16-16, 08:44 AM   #7
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
In this case the ChallengeModeCompleteBannerMixin is the template while the ChallengeModeCompleteBanner is the actual frame they use in-game.

The Mixin is the class, while the other object is the actual instance. Their mixin code basically just loops through all the keys on the Mixin object and assigns them to the new table/frame and references the methods from the original.

This is a micro example of a mixin:
Code:
local GoldMixin = { copper = 0, change = function(self, n) self.copper = self.copper + n end } -- some generic gold mixin for whatever purpose

local playerGold = {} -- our actual instance that represents the player gold
for k,v in pairs(GoldMixin)do playerGold[k]=v end -- this is what the CreateMixin() API does that Blizz often uses, they also have a XML handler for the same thing when doing this from XML files
playerGold:change(1000) -- working with the method
__________________
Profile: Curse | Wowhead
  Reply With Quote