|
| 28 Aug 2013 06:08 AM |
| Ok, so I know what local does, defines a variable for that "part" of the script, but when would I use it? |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 06:31 AM |
I recomend looking it up on roblox.wiki.com I would provide a link, but my internet is being slow. |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 28 Aug 2013 06:39 AM |
| You use it when you don't want variable interference across scopes. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 06:47 AM |
You would use a local variable when you don't want it to interfere with other blocks of code. Unlike global variables (which are created like locals, except you remove the "local"), this can be useful if you might be using the same variable for different purposes.
I'm not terribly high-tier on my scripting capabilities, but I'm fairly sure about what I know. If I'm wrong about anything, feel free to point it out. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 10:41 AM |
Thanks guys. My only question now is when should I use local? Should I just use it all the time? I suppose I'm fine without it, having my skills as low as they are.
And thanks guys. :D |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 28 Aug 2013 11:03 AM |
1 reason is for utter laziness when you want to reuse a variable without tampering another function.
Another reason is to define before-hand so a value isn't returned nil.
I think that only happens when you use a variable function that uses it's own self inside that function.
|
|
|
| Report Abuse |
|
|