| |
|
|
| 07 Apr 2013 06:13 PM |
localising...
Is necessary is you are dealing with a single function that uses some variables being run while others instances of it are running. |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Apr 2013 06:20 PM |
| Its keeps certain variables contained in one scope so that they don't interfere with another scope. They can also be used to avoid being caught by getfenv and will not show up on loadstring threads either. |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2013 06:24 PM |
It's so that variables are kept to one scope, and all the scopes within that scope.
varA = 12 for i = 1, 10 do local varB = 32 print(varA, varB) -- 12 32 varB = varB + 1 end print(varA, varB) -- 12 nil |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 07 Apr 2013 06:26 PM |
| Locals are also faster to access than the global scope, but you are limited to 250 (or 200, I think) per scope. |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2013 06:26 PM |
| http://wiki.roblox.com/index.php/Scope |
|
|
| Report Abuse |
|
|
crusada91
|
  |
| Joined: 04 Sep 2010 |
| Total Posts: 684 |
|
| |
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 07 Apr 2013 06:29 PM |
From llimits.h (I believe this is Lua 5.2.1 though)
/* ** maximum depth for nested C calls and syntactical nested non-terminals ** in a program. (Value must fit in an unsigned short int.) */ #if !defined(LUAI_MAXCCALLS) #define LUAI_MAXCCALLS 200 #endif
/* maximum stack for a Lua function */ #define MAXSTACK 250
|
|
|
| Report Abuse |
|
|
crusada91
|
  |
| Joined: 04 Sep 2010 |
| Total Posts: 684 |
|
| |
|