None prop making support

This commit is contained in:
세젤귀 고양이들 2021-12-24 21:38:57 +09:00
parent 7d4655bb65
commit a74c7842b1

View file

@ -154,17 +154,24 @@ function module.init(shared)
-- import quad object
function new.import(ClassName,defaultProperties) -- make new quad class object
if type(ClassName) == "userdata" and ClassName.ClassName == "ModuleScript" then
ClassName = require(ClassName);
end
local this = defaultProperties or {};
setmetatable(this,{
__call = function (self,prop)
if type(prop) == "string" then
local propType = type(prop);
if propType == "string" then
local lastName = prop;
return function (nprop)
nprop = nprop or {};
nprop.Name = lastName;
local item = make(ClassName,nprop);
addObject(lastName,item);
return item;
end;
elseif propType == "nil" then
return make(ClassName);
end
return make(ClassName,prop,this);
end;