do
You can use do ... end to make a "block". This can be useful if you want to have a local variable limited in scope, eg.
do
local foo = 22
-- use foo here
end -- of do
Also you need to use "do ... end" if you want to put a return inside the middle of a function (eg. for testing), like this:
do return endLua keyword/topics
- assignment
- break
- comments
- data types
- for (generic)
- for (numeric)
- function
- identifiers
- if / then / else
- keywords
- local
- logical operators
- precedence
- relational operators
- repeat
- return
- string literals
- tables
- while
Topics
- Lua LPEG library
- Lua PCRE regular expression functions
- Lua SQLite (database) interface
- Lua base functions
- Lua bc (big number) functions
- Lua bit manipulation functions
- Lua coroutine functions
- Lua debug functions
- Lua io functions
- Lua math functions
- Lua os functions
- Lua package functions
- Lua script extensions
- Lua string functions
- Lua syntax
- Lua table functions
- Lua utilities
- Scripting callbacks - plugins
- Scripting