Register forum user name Search FAQ

break

The break statement is used to terminate a loop (while, repeat or for loop) early.

For example:

while true do
  if mob_in_room () then
    break
  end -- if
end -- while


Also see the return statement which is used to leave the current function (not just the current loop).


See Also ...

Lua keywords/topics

assignment
comments
data types
do
for (generic)
for (numeric)
function
identifiers
if / then / else
keywords
local
logical operators
precedence
relational operators
repeat
return
string literals
tables
while

Topics

Lua base functions
Lua bc (big number) functions
Lua bit manipulation functions
Lua coroutine functions
Lua debug functions
Lua io functions
Lua LPEG library
Lua math functions
Lua os functions
Lua package functions
Lua PCRE regular expression functions
Lua script extensions
Lua SQLite (database) interface
Lua string functions
Lua syntax
Lua table functions
Lua utilities
Scripting
Scripting callbacks - plugins

(Help topic: lua=break)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.