using timer sharing; #114

This commit is contained in:
copycat-killer 2016-03-02 13:48:55 +01:00
parent bceaadb433
commit 5f902517ff
1 changed files with 5 additions and 2 deletions

View File

@ -77,8 +77,11 @@ end
helpers.timer_table = {}
function helpers.newtimer(name, timeout, fun, nostart)
helpers.timer_table[name] = capi.timer({ timeout = timeout })
function helpers.newtimer(_name, timeout, fun, nostart)
local name = timeout
if not helpers.timer_table[name] then
helpers.timer_table[name] = capi.timer({ timeout = timeout })
end
helpers.timer_table[name]:connect_signal("timeout", fun)
helpers.timer_table[name]:start()
if not nostart then