timer.lua 757 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. -- timer.lua
  2. local timer = {}
  3. timer.__index = timer
  4. --[[
  5. 创建一个新的 fw_timer 对象
  6. @return 返回一个新的 fw_timer 对象
  7. ]]
  8. function timer.new()
  9. local instance = setmetatable({}, timer)
  10. instance.module = fw_timer.new()
  11. return instance
  12. end
  13. --[[
  14. 增加一个定时器
  15. @param name 定时器名称
  16. @param filepath LUA脚本文件路径
  17. @param msec 时间间隔(毫秒)
  18. @return 返回一个字符串标识
  19. ]]
  20. function timer:add(name, filepath, msec)
  21. return self.module:add(name, filepath, msec)
  22. end
  23. --[[
  24. 移除一个定时器
  25. @param name 定时器名称
  26. ]]
  27. function timer:remove(name)
  28. self.module:remove(name)
  29. end
  30. function timer:self()
  31. return self.module:self()
  32. end
  33. return timer