props bug fixed

This commit is contained in:
세젤귀 고양이들 2021-12-24 22:49:30 +09:00
parent cdc11d4c2b
commit acc8f403e7

View file

@ -53,20 +53,14 @@ function module.init(shared)
local func = ClassName.new or ClassName.New or ClassName.__new; local func = ClassName.new or ClassName.New or ClassName.__new;
if ClassName.__noSetup then -- if is support initing props if ClassName.__noSetup then -- if is support initing props
local childs,props = {},{...}; local childs,props = {},{...};
local parsed; local parsed = {};
for iprop = #props,1,-1 do for iprop = #props,1,-1 do
local prop = props[iprop]; local prop = props[iprop];
for i,v in ipairs(prop) do
childs[i] = ((iprop == 1) and v or v:Clone());
prop[i] = nil;
end
if next(prop) then -- there are (key/value)s
if parsed then
for i,v in pairs(prop) do for i,v in pairs(prop) do
parsed[i] = v; if type(i) == "number" then
end childs[i] = ((iprop == 1) and v or v:Clone());
else else
parsed = prop; parsed[i] = v;
end end
end end
end end
@ -166,12 +160,12 @@ function module.init(shared)
return function (nprop) return function (nprop)
nprop = nprop or {}; nprop = nprop or {};
nprop.Name = lastName; nprop.Name = lastName;
local item = make(ClassName,nprop); local item = make(ClassName,nprop,this);
addObject(lastName,item); addObject(lastName,item);
return item; return item;
end; end;
elseif propType == "nil" then elseif propType == "nil" then
return make(ClassName); return make(ClassName,this);
end end
return make(ClassName,prop,this); return make(ClassName,prop,this);
end; end;