A block is a sub-part of Chunk, they can be the same as in the code example 02: for example, 01:
if condition1 then block1 elseif condition2 then block2 elseif condition3 then block3 else block4 end
here we have one piece starting with
if condition 1, then for the last end but this code has four blocks, each condition has a separate block. this example has one piece and four blocks.
Example 02:
/////////////////////////// 01 ////////////////////// for variable = beginning, end, step do block end /////////////////////////// 02 ////////////////////// function Name() block end /////////////////////////// 03 ////////////////////// if condition then block end
in example 02, the piece and block are the same, but they are always not the same. read for yourself.
http://www.lua.org/manual/2.5/manual.html
4.4.1 - Blocks
A block is a list of statements that are executed sequentially. Any instruction may be followed by a semicolon:
block: = {stat sc} [ret] sc: = [';']
2 - Environment and pieces
The unit of execution of Lua is called a piece. The syntax for the pieces is:
chunk: = {stat | function} [ret]
this is useful?????
source share