Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何删除所有timer与我共进午餐的 s timer.performWithDelay?
timer
timer.performWithDelay
我试过的:
for id in pairs(timer) do print("timer: " .. id) if id ~= nil then timer.cancel( id ) end end
使用计时器表私有变量:
for id, value in pairs(timer._runlist) do timer.cancel(value) end
否则,最好的“合法”方法是将您的计时器 ID 存储在您自己的表中,例如:添加计时器:
aTimers = {} aTimers[0] = timer.performWithDelay( 1000, yourFunction, 0 )
取消定时器:
timer.cancel(aTimers[0])