Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// Class Creation Module
- Class = {}
- function Class:new(o)
- o = o or {}
- setmetatable(o, self)
- if o.OnNew then
- o:OnNew()
- end
- return o
- end
- car = Class:new {
- OnNew = function() print("car created") end,
- id = math.random(1, 10000000),
- }
- function car:dostuff()
- print("stuff!", self.id)
- end
- return car
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement