View Single Post
  #6  
Unread 04-21-2013, 11:29 PM
Stever1388 Stever1388 is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Nov 2010
Posts: 33
Quote:
Originally Posted by Garan
You could add a .Player value to the self.effectList[] table entries to create a link back to the player:
change EffectTracker:HandleEffects to
Code:
function EffectTracker:HandleEffects(player)
 self.effectList[player:GetName()] = player:GetEffects(); -- kept for removecallback function
 self.effectList[player:GetName()].Player=player; -- creates a link back to the player
 AddCallback(player:GetEffects(), "EffectAdded", self.effectAddedHandler);
end
and then in effectAddedHandler you could use sender.Player
Code:
self.effectAddedHandler = function(sender, args)
 -- outputs data to chat window (code not important to discussion)
  --sender.Player references the player for this effect list
end
This is an interesting way to do it too. Any real advantage to doing it either way?
Reply With Quote