Comments are lines of code that scripts completely ignore, and you can put anything in comments to keep your scripts more organized and less messy. This is also useful for leaving notes for yourself.
To use comments, all you have to do is put double hyphens (--) and then type whatever you want, like this:
--This is a comment. It has -- at the beginning of this line.
As mentioned above, comments are ignored when scripts are ran. To prove this, these lines of code will print "Test" in the output.
--This is a comment. The script will ignore this.
print("Test")
Additionally, comments can be combines with lines of code that the script won't ignore like so:
print("Test") --This also works fine.
Long comments are multiple lines that are all one big comment. In order to make long comments, you need to make double hyphens -- and double brackets to start the long comment [[ then eventually end the long comment with another pair of double brackets ]] like so:
--[[
This is a long comment.
The brackets at the beginning make this long comment.
Anything inside the brackets will be ignored, like a regular comment.
This long comment will end right about now.
--]]
As mentioned at the beginning of this tutorial, comments are commpnly used to make code more organized, and for notes that developers may find handy in scripts. Comments are quite useful to know if you want to have a clean, easy-to-navigate scripts.