Register forum user name Search FAQ

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 end


See Also ...

Lua keywords/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 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=do)

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.