Does the 'break' keyword only break the loop that it is in? (In other words, if I have a loop inside another loop, does 'break' break both loops or just the one it's in?)
break
will only exit the immediate loop.
There isn't a way to break
up multiple levels of loops directly (you would need to set a variable and break
again in the next loop)
return
will break through all loops and exit the current function.
Lua 5.2 includes labeled goto
s, which can emulate the functionality of breaking up arbitrarily high.
The practice of using GOTOs at all is fairly contested in the modern world. Historically, GOTOs have been a poor solution in comparison to other options; in higher level languages their evilness fades somewhat so many modern authors argue that there is nothing wrong with using GOTO anymore.
Nevertheless, ROBLOX has not yet upgraded to Lua 5.2, so in ROBLOX, that is not available to you.