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?