Delay Call
usysrc opened this issue · 1 comments
usysrc commented
Tween.lua is really awesome! Great work. I usually extend it with a 'delay call' interface function like this
function tween.delay(time, callback, ...)
return tween.start(time, {}, {}, 'linear', callback, {...})
end
maybe there is a better way? Would it make sense to include this?
kikito commented
Hi!
I'm glad that you liked it, thanks!
Concerning your question - well, it's a bit "hacky" to put it there - teen.lua is for tweening things, and that function is not tween-related (you could use it for anything).
I had the same problem that you did, some time ago, and I developed a lib for that: cron.lua.
The function cron.after does exactly what you are mimicking with your tween.delay. You also get a function for periodical actions (cron.every) for free.
Regards!