Variables are values of places in memory, when you create a new local variable inside that function, that is an entirely new memory position the value is stored in.
Every time you run that function the local variable is created anew, and will get the "latest" from the global variable (there's no static variables in Lua).
The only reason you'd want to differentiate the variable naming in a scenario like this is to avoid confusion, nothing more.
|