I was wondering if anyone could explain to me what the equals signs mean in multiple line comments. eg. --[==[. I have looked on the roblox site however am confused with the term 'levels'.
When we usually end a multi-line comment using ]], we can accidentally end the comment (such as commenting out code that makes use of tables or dictionaries.)
Here is an example:
local list = {'a','b','c'} local example = {a = 1, b = 2, c = 3} --[[ while true do local var = example[list[1]] --The comment ends here. print(var) wait() end ]] print(true)
When we run this, we get an error: unexpected symbol near ']'
To leverage this situation, we can add an equal sign in the front and back (or more) to define a new delimiter to end the comment. The catch is that it needs to be have equal amount of signs in the beginning at the end.
local list = {'a','b','c'} local example = {a = 1, b = 2, c = 3} --[==[ while true do local var = example[list[1]] print(var) wait() end ]==] --Comment ends here now. print(true)
When we run this, it prints as expected: true
If this answers your question, please accept this as the solution.