“The people outside of these forums don’t see much of a difference between using your create() function and writing it out manually.”
How out-of-touch are you? Are you assuming that every person that’s not a member of the forums is a complete and utter idiot? Just because someone isn’t a member of the forums doesn’t mean that they can’t program.
“That’s the exact reason local variables and garbage collection was invented.”
Computational performance was not my concern. Have you ever read “The Magic Number Seven”? Humans can only keep track of ~7 things in their brain at a time. Needlessly spamming variables that will not be needed more than five lines later just makes it harder to keep up an overview of your own code.
I think create is a terrible thing to use. You need to put a table into memory just to throw it away afterwards, and the order is not as expected. There are a million cases where someone could come up with some weird hack that saves a few seconds.
If you type the same thing over and over, make a function for it. (this applies to everything)
local function createPart()
local p = Instance.new("Part")
p.Anchored = true
p.TopSurface = 0
p.BottomSurface = 0
return p
end
local superDescriptiveVariableName = createPart()
Even this would be better than create, lol:
local superDescriptiveVariableName = (function()
local p = Instance.new("Part")
p.Anchored = true
p.TopSurface = 0
p.BottomSurface = 0
return p
end)()
or
local superDescriptiveVariableName; do
local p = Instance.new("Part")
p.Anchored = true
p.TopSurface = 0
p.BottomSurface = 0
superDescriptiveVariableName = p
end
The people outside of these forums don’t see much of a difference between using your create() function and writing it out manually.
That’s the exact reason local variables and garbage collection was invented.
By the way, that is in-studio. You have to prestige to Elite Grand-Master Script-Kid rank.[/quote]
Actually, garbage collection doesn’t collect local variables like you seem to think it does. If you say local >200 times in the same scope (includes higher scopes) you will get an error because you have more than 200 local variables. Even if you write out: