mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-26 15:44:35 +00:00
[modified] class supports inheriting from classes/apis without a new method - in that case the super ctor wont be called automatically as part of init()
This commit is contained in:
parent
93e6073128
commit
19c21bf308
@ -24,7 +24,7 @@ local function class(inherits)
|
|||||||
--sets up an initialised object with a default value table
|
--sets up an initialised object with a default value table
|
||||||
--performing a super construction if necessary and assigning the right metatable
|
--performing a super construction if necessary and assigning the right metatable
|
||||||
function c:init(t, ...)
|
function c:init(t, ...)
|
||||||
if inherits then
|
if inherits and inherits.new then
|
||||||
--construct superclass instance, then overlay args table
|
--construct superclass instance, then overlay args table
|
||||||
local ct = inherits:new(...)
|
local ct = inherits:new(...)
|
||||||
for k,v in pairs(t) do
|
for k,v in pairs(t) do
|
||||||
|
Loading…
Reference in New Issue
Block a user