Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
Line, block and nested comments - Lua compared to other languages
You can comment your Lua program in two ways.
a) using comments that start -- , in which case they run to the end of the line - so that's a line comment
b) starting --[[ , in which case they run through to the next ]] which may be in the same line, or a number of lines later - so that's a block comment
Line and block comments are common in many other languages too
• in PHP, for example, a line comment starts with a # or //, and a block comment runs from /* to */.
• in C++ and in Java, line comments start with //, and block comments run from /* to */.
• ANSI C only supports block comments from /* to */, though some extended compilers accept line comments from //.
&bull, In Tcl, Perl and Python you have just line comment support from # to the end of the line
and in all the languages we teach, blank lines will be ignored too so are in effect a separating comment
One of the things I regret about block comments in most langauges is that they cannot be nested. In other words, you can't write a comment with a comment. "Does this matter?" you ask. Yes, it does to me ... I want to be able to comment out a whole block of code that's already got comments within it, and that's a problem where the end of the inner comment also forces the end of the outer comment. Lua (uniquely in the languages we teach) provides a solution in that block comments can start with extra = signs between the [ and [, and then the terminating sequeence need to have the same number of == signs ... so
print ("This will be printed first")
--[===[ Comment out a whole big block!
--[[ This is a multiline comment telling you about
the work this code is doing ]]
print ("This will not be printed in the middle")
--[[ This is another multiline comment telling you about
the work this code is doing ]]
end of big block comment ]===]
print ("This will be printed last")
will just print out two lines, with the one in the middle being skipped.
Examples, in context - see [here]
. (written 2014-05-04, updated 2014-05-06)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesU101 - Introduction to Lua. 
Learning to program - variables and constants - (2014-11-22) 
Learning to Program in Lua - public / open training course / class - (2012-05-09) 
Learning to write high quality code in Lua - (2009-07-30) 
Lua Course, and the Wiltshire Countryside too - (2008-10-16) 
Rules, suggestions, considerations for Lua variable names - (2008-08-05) 
If you are learning Lua, here are some more examples - (2008-07-06) 
Lua Course - here is the index - (2008-07-03) 
Training in Lua - (2007-03-16)
Some other Articles
Eurpoean Elections, and other elections ahead. Some thoughts on campaigns and policiesString formatting in Lua - string.format as a wrapper for sprintfDot or Colon separator between table name and member in Lua - what is the difference?Lazy operators in Lua - what they mean, and examplesLine, block and nested comments - Lua compared to other languagesEmbedding Lua to perform tailored code at an intervalSurvey - JourneysMetrics - historic and current TransWilts train useHow effective is our publicity?Facebook marketing - who are we reaching?
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page
This is a page archived from The Horse's Mouth at
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).