flickyclone/object.lua
2024-09-02 10:37:49 -03:00

29 lines
550 B
Lua

local inspect = require("inspect/inspect")
local Object = {}
Object.__index = Object
function Object:new(...)
local object = setmetatable({__index=self}, self)
object.__class = self
object:init(...)
return object
end
function Object:init(...)
self.__args = {...}
end
function Object:extend(SubClass)
SubClass = SubClass or {}
for k, v in pairs(self) do
if k:match("^__") then
SubClass[k] = v
end
end
SubClass.__index = SubClass
SubClass.__super = self
return setmetatable(SubClass, self)
end
return Object