This commit is contained in:
세젤귀 고양이들 2021-12-24 20:04:08 +09:00
parent 2c5506f17f
commit af331777b6
2 changed files with 18 additions and 5 deletions

View file

@ -193,11 +193,11 @@ function module.init(shared)
rawset(self,"__holder",object);
if parent then
rawset(self,"__parent",parent);
mount(item,parent)
mount(self,parent)
end
-- prevent gc
((type(object) == "table" and object.__object) or object):GetPropertyChamgedSignal "ClassName":Connect(function()
return item;
return self;
end);
return self;
end
@ -222,13 +222,13 @@ function module.init(shared)
if child then
for _,v in pairs(child) do
if v then
((type(v) == "table") and rawget(v,"__object") or v).Parent = object;
v.Parent = object;
end
end
end
-- prevnet gc
((type(object) == "table" and object.__object) or object):GetPropertyChamgedSignal "ClassName":Connect(function()
return item;
return self;
end);
if lastObject then -- remove old instance
self:Destroy(lastObject);

View file

@ -33,9 +33,22 @@ function module.init(shared)
local thisO = this;
if type(this) == "table" then
thisO = this.__object;
local parent = rawget(this,"__parent");
if type(parent) == "table" then
local parentChild = rawget(parent,"__child");
if parentChild then
for i,v in pairs(parentChild) do
if v == this then
parentChild[i] = nil;
end
end
end
end
rawset(this,"__parent",to);
end
thisO.Parent = inst or getHolder(to);
if thisO then
thisO.Parent = inst or getHolder(to);
end
if type(to) == "table" then
local child = rawget(to,"__child");
if not child then