timer fix
This commit is contained in:
parent
589c48653f
commit
fd3917a8fd
|
@ -1847,30 +1847,25 @@ end
|
||||||
timer = obj { -- timer calls stead.timer callback
|
timer = obj { -- timer calls stead.timer callback
|
||||||
nam = 'timer',
|
nam = 'timer',
|
||||||
ini = function(s)
|
ini = function(s)
|
||||||
if s._timer ~= nil and s._timer ~= 0 then
|
if tonumber(s._timer) ~= nil and type(set_timer) == 'function' then
|
||||||
set_timer(s._timer);
|
set_timer(s._timer);
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
get = function(s)
|
get = function(s)
|
||||||
if s._timer == nil then
|
if tonumber(s._timer) == nil then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
return tonumber(s._timer);
|
return tonumber(s._timer);
|
||||||
end,
|
end,
|
||||||
stop = function(s, v)
|
stop = function(s)
|
||||||
s._timer = nil;
|
return s:set(0);
|
||||||
if set_timer == nil then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
set_timer(0)
|
|
||||||
return true
|
|
||||||
end,
|
end,
|
||||||
del = function(s, v)
|
del = function(s)
|
||||||
return s:stop(v);
|
return s:set(0);
|
||||||
end,
|
end,
|
||||||
set = function(s, v)
|
set = function(s, v)
|
||||||
s._timer = tonumber(v);
|
s._timer = tonumber(v);
|
||||||
if set_timer == nil then
|
if type(set_timer) ~= 'function' then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
set_timer(v)
|
set_timer(v)
|
||||||
|
|
Reference in a new issue