'Global' local variables vs Global variables

In this example set of code:

http://developer.anscamobile.com/code/break-out-game

In the example of bricky6withComments, at the top it mentions this:

main.lua

--[[ Any functions and variables that we want to use "globally" can be declared as local up here.  
 The advantage of doing this here is that we can treat them like globals below, while also  
 retaining the compiler optimization that results from local variables in Lua.  
 (Note: this comment also demonstrates multi-line Lua comment syntax.)  
--]]  
local main, newBall, moveBall, gameOver, killBrick, removeBrick, createBall, removeBall, newLevel  
local ball, paddle, brick, brickImage, brickValue, brickCounte  
  

What, specifically, is gained from declaring your global variables (and perhaps functions?) as local, in main.lua?

Speed somehow?
[import]uid: 8541 topic_id: 2755 reply_id: 302755[/import]

Yes, speed. Local variables are placed on the stack so LUA can interface them faster. [import]uid: 5712 topic_id: 2755 reply_id: 8283[/import]

Oh just great… I have some serious local pasting to do now.

Thanks!

[import]uid: 8541 topic_id: 2755 reply_id: 8284[/import]

Don’t optimize before your game is done. [import]uid: 5712 topic_id: 2755 reply_id: 8293[/import]