local a = {};
a.new = function(b)
local s = {};
s.b = b;
return setmetatable(s, {__index = a})
end
function a:c()
print(self.b)
end
return a;
“a” inherits “d”.
local d = {};
local a = require(script.Parent.a)
setmetatable(d, {__index = a})
d.new = function(b)
local s = a.new(b);
s.e = b;
return setmetatable(s, {__index = d})
end
function a:f()
print(self.b, self.e)
end
return a;
Following these principles, the a class would become:
local a = {};
a.new = function(b)
local s = {};
setmetatable(s, a)
s.b = b;
return s
end
function a:c()
print(self.b)
end
return a;
and the d class would become:
local a = require(script.Parent.a)
local d = {};
d.__index = d
d.new = function(b)
local s = a.new(b);
setmetatable(s, d)
s.e = b;
return s
end
function d:f()
print(self.b, self.e)
end
return d;
(I also completely forgot to mention that your d class actually returns a, and also sets the f method of a, instead of d.)