Comments

Learn how to put comments in scripts.

by GalaxyGourmet

Author Avatar

About Comments

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.

How to Use Comments

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

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.
--]]

Why to Use Comments

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.

View in-game to comment, award, and more!