None prop making support
This commit is contained in:
parent
7d4655bb65
commit
a74c7842b1
1 changed files with 8 additions and 1 deletions
|
|
@ -154,17 +154,24 @@ function module.init(shared)
|
||||||
|
|
||||||
-- import quad object
|
-- import quad object
|
||||||
function new.import(ClassName,defaultProperties) -- make new quad class 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 {};
|
local this = defaultProperties or {};
|
||||||
setmetatable(this,{
|
setmetatable(this,{
|
||||||
__call = function (self,prop)
|
__call = function (self,prop)
|
||||||
if type(prop) == "string" then
|
local propType = type(prop);
|
||||||
|
if propType == "string" then
|
||||||
local lastName = prop;
|
local lastName = prop;
|
||||||
return function (nprop)
|
return function (nprop)
|
||||||
|
nprop = nprop or {};
|
||||||
nprop.Name = lastName;
|
nprop.Name = lastName;
|
||||||
local item = make(ClassName,nprop);
|
local item = make(ClassName,nprop);
|
||||||
addObject(lastName,item);
|
addObject(lastName,item);
|
||||||
return item;
|
return item;
|
||||||
end;
|
end;
|
||||||
|
elseif propType == "nil" then
|
||||||
|
return make(ClassName);
|
||||||
end
|
end
|
||||||
return make(ClassName,prop,this);
|
return make(ClassName,prop,this);
|
||||||
end;
|
end;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue