|
| 21 Mar 2014 11:04 PM |
| I vaguely understand it, I never fully understood what it meant. Be specific on exactly what it does and what it is used for. |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 11:06 PM |
The local variable can only be used in its scope EXAMPLE:
while true do local pie = 1
for _,v in pairs (lol) do --pie can be used here local apples = 5 end --apples can not be used here -- if it is... print(apples) end >ERROR: apples does not exist |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 11:07 PM |
| http://wiki.roblox.com/index.php?title=Scope |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 11:09 PM |
| What exactly is a scope? I think I know what it is I just want to be sure. |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 11:09 PM |
^It wouldn't error, it would just return nil.
local makes the variable values in the scope have a different value.
Example that is different than above:
ducks = 5 do--starts a new scope local ducks = 7534 print(ducks)--prints 7534 end print(ducks)--prints 5
|
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 11:13 PM |
| btw lead I replied on the other forum post please reply. And thanks kiwi. |
|
|
| Report Abuse |
|
|
transIate
|
  |
| Joined: 20 Jun 2013 |
| Total Posts: 2699 |
|
| |
|