[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:
Max Cahill 2020-05-14 15:27:24 +10:00
parent 93e6073128
commit 19c21bf308

View File

@ -24,7 +24,7 @@ local function class(inherits)
--sets up an initialised object with a default value table
--performing a super construction if necessary and assigning the right metatable
function c:init(t, ...)
if inherits then
if inherits and inherits.new then
--construct superclass instance, then overlay args table
local ct = inherits:new(...)
for k,v in pairs(t) do