Pop.Box/class.lua

22 lines
382 B
Lua
Raw Normal View History

2017-08-14 12:48:36 +00:00
local Class
2017-08-14 12:49:35 +00:00
Class = function(name)
2017-08-14 12:48:36 +00:00
local newClass, base
base = {
__index = base,
__class = newClass
}
newClass = setmetable({
__init = function() end,
__base = base,
__name = name
}, {
__call = function(cls, ...)
local self = setmetable({ }, base)
cls.__init(self, ...)
return self
end
})
2017-08-14 12:49:35 +00:00
return newClass
2017-08-14 12:48:36 +00:00
end
return Class