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'.
✓ ANSWER ACCEPTED
What do the equals signs mean in multiple line comments? (see desc for details)
1 answer
✓ Accepted answer
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.
1 comment
0
Thanks. Just what I was looking for. :)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
that is used in if statements eg if game.Workspace.Gravity == 0 then, its not used anywhere else