Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local classes={
- base={
- className="base"
- }
- }
- local function addClass(name,base,tab)
- tab.className=name
- tab.super=base
- classes[name]=setmetatable(tab,{
- __index=base,
- __call=function(self,...)
- local new=setmetatable({},{__index=self})
- if new.new then new:new(...) end
- return new
- end
- })
- return tab
- end
- return {
- class=function(name)
- return function(arg1)
- if type(arg1)=="string" then
- return function(arg2)
- return addClass(name,classes[arg1],arg2)
- end
- end
- return addClass(name,classes.base,arg1)
- end
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment