Showcase your libraries, tools and other projects that help your fellow love users.
Kaze
Party member
Posts: 189 Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland
Post
by Kaze » Sun Mar 15, 2009 4:21 pm
Usage:
Include timer.lua
Code: Select all
timer.new( delay, extra repitions(-1 will never stop), callback, ... arguments )
This returns a timer object, of which these functions are applicable:
Code: Select all
timer:update( dt )
timer:setCallback( callback, ... arguments )
timer:stop( )
timer:start( )
timer:reset( boolShouldResetReps )
timer:setDelay( delay, reps )
Simple timers
Add this to update:
timer.newSimple:
Code: Select all
timer.newSimple( delay, callback, ... arguments )
Public domain.
Timers.love
Press any key, a "Hello world" will display 5 seconds after. (1003 Bytes) Downloaded 207 times
Last edited by
Kaze on Sun Mar 15, 2009 9:25 pm, edited 2 times in total.
bartbes
Sex machine
Posts: 4946 Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:
Post
by bartbes » Sun Mar 15, 2009 4:27 pm
I just looked at it, but it would be even nicer if you could just update individual timers. (or at least have the possibility to do so) Example:
Code: Select all
mytimer = timer.new(5, print, "5 seconds passed")
mytimer:update(dt)
--or double speed
mytimer:update(dt*2)
Kaze
Party member
Posts: 189 Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland
Post
by Kaze » Sun Mar 15, 2009 6:40 pm
bartbes wrote: I just looked at it, but it would be even nicer if you could just update individual timers. (or at least have the possibility to do so) Example:
Code: Select all
mytimer = timer.new(5, print, "5 seconds passed")
mytimer:update(dt)
--or double speed
mytimer:update(dt*2)
The thread is titled "
Simple timers" for a reason.
Might do an advanced version later.
bartbes
Sex machine
Posts: 4946 Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:
Post
by bartbes » Sun Mar 15, 2009 6:50 pm
Isn't that hard, is it?
Talking about usage I think it makes things easier.
Kaze
Party member
Posts: 189 Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland
Post
by Kaze » Sun Mar 15, 2009 9:24 pm
Updated.
bartbes
Sex machine
Posts: 4946 Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:
Post
by bartbes » Mon Mar 16, 2009 6:42 am
Great! (Just like user support)
S-Rave
Prole
Posts: 39 Joined: Wed Feb 25, 2009 4:41 pm
Post
by S-Rave » Mon Mar 16, 2009 11:19 pm
Woohoo! Awesome!
srejv
Kuromeku
Party member
Posts: 166 Joined: Sun Jul 20, 2008 5:45 pm
Post
by Kuromeku » Tue Mar 17, 2009 10:38 am
I already made this as part of the short-lived kudoLib, sigh, but good job anyway.
Users browsing this forum: Ahrefs [Bot] and 2 guests