From 79653613655c00461b61bed241a4a0020c6621aa Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Wed, 25 Oct 2017 22:18:52 +0800 Subject: [PATCH] Fix event library --- libevent.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libevent.lua b/libevent.lua index 03e9a09..f436ff8 100644 --- a/libevent.lua +++ b/libevent.lua @@ -31,11 +31,11 @@ end function AddTimer(Interval,CallbackFunction,Times) checknumber(Interval) checkfunction(CallbackFunction) - if(type(Times)~=nil) then -- Timer will run [Times] times. - checknumber(Times) + checknumber(Times) + if(Times<1) then -- Timer will infinitly run (when times <0) + return event.timer(Interval,CallbackFunction,math.huge) + else -- Timer will run [Times] times. return event.timer(Interval,CallbackFunction,Times) - else -- Timer will run once. - return event.timer(Interval,CallbackFunction) end end