Multi line comments

is there another way to make notes across multiple lines other then

--[[ 
hi
]]

as I cant use it because my code is using ] already thanks

3 Likes

Just do this

--Multi
--Line
--Comment
1 Like

the code im trying to comment is over 100 lines so thats not really an option

Well, this is official roblox developer site that shows type of comments, maybe it will help

You could select the code you want to comment and click ‘Toggle Comment’ in the SCRIPT tab

5 Likes

Try doing this:

--[[
Whatever blah blah blah
--]]

workspace["Haha you can use brackets now!!"]

you need to end the comment in brackets too.

2 Likes

I’m sure the problem they are facing is like this

local my_indecies = ["first", "second", "third"]
local my_dictionary = {
    first = 111,
    second = 1234,
    third = 0,
}

--[[ i am going to comment everything hahaha!!
local function get_dictionary(index: number)
    return my_dictionary[my_indecies[index]]
end
]] -- argh!?!?!?
1 Like
--[[ i am going to comment everything hahaha!!
local function get_dictionary(index: number)
    return my_dictionary[my_indecies[index]]
end
--]]

and hyphens, I should have clarified.
edit: You DON’T need hyphens for the end, I just got confused. :sweat_smile:

1 Like

Right, even with the initial hyphens there is a random ‘end’ that isn’t commented out. Along with anything after my_dictionary[my_indecies[index]], which is a valid statement on it’s own but triggers ending a multiline-commet.

You can just insert a space between the two ]] in your code as it detects only if they are next to each other, like here:

local my_indecies = ["first", "second", "third"]
local my_dictionary = {
    first = 111,
    second = 1234,
    third = 0,
}

--[[ i am going to comment everything hahaha!!
local function get_dictionary(index: number)
    return my_dictionary[my_indecies[index] ]
end
]]
2 Likes

Or you could pull the inner index out to a new variable. It’s a stylistic change if you like no_gap[indecies] then randomly have to add gaps_between[ indecies ] so you can keep a feature of the language. It’s one point of bad syntax design in lua, it must’ve come up enough for roblox to add a toggle comment button. With Luau I’m surprised they don’t replace it.

1 Like