Comments in Lua

Comments in Lua is used to explain the operation of variables, functions, loops, and other pieces of code. This is useful both to the developer other people to quickly understand the program. Comments also help organize thoughts and thereby to simplify the writing of programs. In general, you should comment more and more to clarify your program.

There are two types of comment in Lua: single-line and multi-line. Single-line comments begin with two cons and everything that comes after the compiler ignores them.

You can use nested comments, but they are perceived as one.

The main thing is not to put the characters – before the executable code. You need to remember that all comments immediately follows the two outs.

Multi-line comment is useful when you need to write a lot of explanatory texts or temporarily exclude from whole pieces of code. Write such a comment like this:

Again, within the comments it is possible to insert another comment like this: