|
| 11 Apr 2013 04:38 PM |
Whats the difference between:
brick = Instance.new("Part")
and
local brick = Instance.new("Part")
Is local only ever used in local scripts? |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 04:39 PM |
| Local makes it run faster and more efficiently. It's also specified to the function it is in. |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 04:48 PM |
| So if I have a function that creates a part, just putting local infront of it will make it run better? |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 04:51 PM |
Here is an example.
function thing()
local a = Instance.new("Part")
a.Parent = game.Workspace would work here, because a was specified as local inside of the function, and this line is also inside of the function
end
thing()
a.Parent = game.Workspace wouldnt work here, because a will only work in the function it was created in, being as its local.
besides that, local variables will be slightly more efficient. |
|
|
| Report Abuse |
|
|
| |
|
| |
|