Chris Klimas committed 50bc54f

Fulfill a timed function call with the results of the call

This allows for chaining deeper into the call, e.g.
timer:after(3, fadeOutSlowly):andThen(switchLevels) will call switchLevels()
after fadeOutSlowly()'s promise is fulfilled, not after the timer fires.

Comments (0)

Files changed (1)


 			timer.timeLeft = timer.timeLeft - elapsed
 			if timer.timeLeft <= 0 then
-				timer.func()
 				if timer.promise then
-					timer.promise:fulfill()
+					timer.promise:fulfill(timer.func())
+				else
+					timer.func()
 				if timer.interval then