mirror of
https://github.com/vrld/hump.git
synced 2024-11-23 12:24:19 +00:00
Adhere to Class-Commons specs with delayed initializers
This commit is contained in:
parent
dfac6aa4ce
commit
e2144b525d
@ -102,9 +102,14 @@ end
|
||||
-- interface for cross class-system compatibility (see https://github.com/bartbes/Class-Commons).
|
||||
if class_commons ~= false then
|
||||
common = common or {}
|
||||
function default_init(self, ...)
|
||||
if self.init and self.init ~= default_init then
|
||||
self.init(...)
|
||||
end
|
||||
end
|
||||
|
||||
function common.class(name, prototype, parent)
|
||||
local init = prototype.init or (parent or {}).init
|
||||
local init = prototype.init or (parent or {}).init or default_init
|
||||
return new{name = name, inherits = {prototype, parent}, init}
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user