Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. lua_class = {}
  2.  
  3. --function to create new class
  4. function lua_class:new(o)
  5. o = o or {}
  6. setmetatable(o, self)
  7. self.__index = self
  8. return o
  9. end
  10.  
  11. -- constructor
  12. function timer_class:new(name, length)
  13. local o = {}
  14.  
  15. o.name = name or "timer"
  16. o.enabled = false
  17. o.paused = false
  18. o.timer = nil
  19. o.t_length = (length or 60) * 1000
  20. o.t_started = 0
  21. o.t_ended = 0
  22. o.t_paused = 0
  23. o.t_restarted = 0
  24. o.t_remaining = 0
  25. o.h_duration = history_class:new(o.name, 10)
  26.  
  27. return class.new(self, o)
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement