View Single Post
02-06-10, 08:53 AM   #27
Hati-EK
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 20
Originally Posted by nightcracker View Post
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

Last edited by Hati-EK : 02-06-10 at 08:57 AM. Reason: fix init run
  Reply With Quote