lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, 1 Oct 2023 at 17:39, bil til <biltil52@gmail.com> wrote:
> a long comment should start --[[ (TWO rect brackets...).

Near miss, in fact:
"A comment starts with a double hyphen (--) anywhere outside a string.
If the text immediately after -- is not an opening long bracket, the
comment is a short comment, which runs until the end of the line.
Otherwise, it is a long comment, which runs until the corresponding
closing long bracket. "

And a little before that ...

"...We define an opening long bracket of level n as an opening square
bracket followed by n equal signs followed by another opening square
bracket. So, an opening long bracket of level 0 is written as [[, an
opening long bracket of level 1 is written as [=[, and so on. A
closing long bracket is defined similarly; for instance, a closing
long bracket of level 4 is written as ]====]...."

I'm particularly fond of the form:

--[==[
...
--]==]

for code commenting ( adding / deleting spaces / hyphens in the first
one turns the code on/off and the last bracket off/on, useful for
debugging )

Francisco Olarte.