Quantcast LoTROInterface - View Single Post - using EffectList:Contains(effect)?
View Single Post
  #4  
Unread 04-20-2019, 10:49 AM
Thurallor's Avatar
Thurallor Thurallor is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: May 2013
Posts: 165
Well, I'm not quite sure how you want to use EffectList:Contains(), but my point is that
if (effectList:Contains(effect)) then
is probably not significantly more efficient than
if (effectIsPresent[effect]) then
where effectIsPresent is a hash table that you have built with
effectList.EffectAdded = function(obj, args)
local effect = obj:Get(args.Index);
effectIsPresent[effect] = true;
end
effectList.EffectRemoved = function(obj, args)
local effect = obj:Get(args.Index);
effectIsPresent[effect] = false;
end

of course assuming that the "EffectRemoved" event is fixed in U24.

Note: I believe each instance of an effect has its own distinct object. So you can't create an Effect object for a given effect and use that for comparison to future instances of that effect.
Reply With Quote