Advertisement
Trioxide

Untitled

Feb 21st, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. --// Class Creation Module
  2.  
  3. Class = {}
  4.  
  5. function Class:new(o)
  6. o = o or {}
  7. setmetatable(o, self)
  8. if o.OnNew then
  9. o:OnNew()
  10. end
  11. return o
  12. end
  13.  
  14. car = Class:new {
  15. OnNew = function() print("car created") end,
  16.  
  17. id = math.random(1, 10000000),
  18. }
  19.  
  20. function car:dostuff()
  21. print("stuff!", self.id)
  22. end
  23.  
  24. return car
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement