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
1 2 3 4 5 6 7 8 9 | --[[ 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 |
Yes, speed. Local variables are placed on the stack so LUA can interface them faster.
Oh just great... I have some serious local pasting to do now.
Thanks!
Don't optimize before your game is done.