Originally Posted by nightcracker
Final question, is it efficienter to use solution #1 or #2? I can hardly imagine that mod is faster then setting a variable to a table, but I may be wrong since frames have metatables etc etc etc...
#1
Code:
self.tslu = self.tslu + elapsed
if self.tslu > .25 then
self.tslu = 0
self:SetAlpha(self.alpha)
end
#2
Code:
self.tslu = self.tslu + elapsed
if self.tslu%.25 < .125 then
self:SetAlpha(self.alpha)
end
|
well to #2:
i would say permanently incrementing of a variable may cause an overflow (dunno about max value in lua) - as you aren't calc the modulo and store it
Code:
self.tslu = (self.tslu + elapsed)%.25
if self.tslu <= elapsed then
self:SetAlpha(self.alpha)
end
might be better