for example:
a = {}
for i = 1,5 do
h = Instance.new("Part",workspace)
table.insert(a,i,h)
end
a[1].Anchored = true
will this work?
for example:
a = {}
for i = 1,5 do
h = Instance.new("Part",workspace)
table.insert(a,i,h)
end
a[1].Anchored = true
will this work?
Yes.
Also, if you want to save some space, you can create the part and enter it into the table at the same time.
Note: You can leave 'i' out of the arguments in the table.insert function on line 4. The script will default to the succeeding table entry.
local a = {}
for i = 1,5 do
table.insert(a,Instance.new("Part",workspace))
end
a[1].Anchored = true
Yeah, i just like the i there just in case
Well, to be more specific about tables, it's like (data) storage. :P
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Why couldn't you run this yourself to see if it would work?
Sure. Just keep in mind you are not storing the objects themselves into the table, just a reference to them.