timer = _threads:getMain():getTimer() id = timer:setInterval(function() _console:log("间隔执行的任务执行了") end, 1000) timer:setTimeout(function() timer:clearInterval(id) end, 3000)