-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMake.lua
More file actions
50 lines (42 loc) · 961 Bytes
/
Make.lua
File metadata and controls
50 lines (42 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- Callable Instance.new wrapper
-- @author Validark
local Instance_new = Instance.new
local function Make(InstanceType)
local function ClosureFunction(Table, ...)
local Object = Instance_new(InstanceType)
local Parent = Table.Parent
if Parent then
Table.Parent = nil
end
for Property, Value in next, Table do
if type(Property) == "number" then
Value.Parent = Object
else
Object[Property] = Value
end
end
if Parent then
Object.Parent = Parent
end
if ... then
local Objects = {...}
for a = 1, #Objects do
local Object = Object:Clone()
for Property, Value in next, Objects[a] do
if type(Property) == "number" then
Value.Parent = Object
else
Object[Property] = Value
end
end
Object.Parent = not Object.Parent and Parent
Objects[a] = Object
end
return Object, unpack(Objects)
else
return Object
end
end
return ClosureFunction
end
return Make