Lua - Nested Multi-Line Comments Syntax Highlighting Error

Long/nested Lua comments using the --[=[ ... ]=] format are not properly syntax-highlighted in Renoise’s Scripting Editor. They are ignored by the interpreter as they should be, but they are just not properly displayed, which does impact their usefulness in development for those who rely on Renoise’s Scripting Editor.

syntax highlighting error


-- bla bla bla


  bla bla bla


  bla bla bla

1,2,3 are used to add text, descriptions… The closing brackets do not need - -

[=[ bla bla bla ]=][==[ bla bla bla ]==], etc. Personally I have never used them. I use single quotes and double quotes for long strings. Something like this:

variable_1 = "the long string... bla bla bla"

variable_2 = "line 1: bla bla bla bla bla bla bla bla bla bla bla bla bla bla "..
             "bla bla bla bla bla bla bla bla bla bla bla bla bla bla."

variable_3 = "line 1: bla bla bla bla bla bla bla bla bla bla bla bla bla bla/n"..
             "line 2: bla bla bla bla bla bla bla bla bla bla bla bla bla bla."
local i=3
table_of_strings={ "bla", "bla bla", "bla bla bla", "bla bla"..i, "1467", "1467"..i }
print(table_of_strings[4]) --> bla bla3 (a string)
print(#table_of_strings[#table_of_strings]) --> 14673 (a string)

Be careful with the /n (line break) and the double point . . (string continuation).

1 Like

Let me try to explain the issue further.

Let’s say you want to comment out a single line of code so it won’t run.
Simply use --


Both Notepad++ and Renoise highlight single-line comment syntax correctly, and Renoise’s Lua interpreter ignores the line correctly.

Now let’s say you want to comment out multiple lines of code.
Simple, you would use a multi-line comment --[[ ]]


Ah, but in this case, the ]] in bar[foo[2]] has closed the comment, and as such, we end up with ) print(bar[foo[3]]) being run, which is undesired.

To remedy cases such as this, Lua allows for nested comments.
The original syntax was --[[--[[ ]] ]], where you can nest as many levels as you need, so long as you close them with a matching amount of closing square brackets.


This syntax is highlighted correctly in both Notepad++ and Renoise. However, the Renoise interpreter gives an error, stating that this syntax has been deprecated, which is correct. Lua 5 now uses a new syntax for nested multi-line comments.

The new syntax is --[=[ ]=] where the amount of = determines how many levels of nesting will be created.


Notepad++ highlights this new syntax correctly, and Renoise interprets it correctly as well, ignoring the 2nd and 3rd print commands.

However, Renoise does not properly highlight the new syntax. This can lead to a great deal of confusion and unnecessary bugs, as you can imagine, if one is using these types of comments in the Renoise scripting editor.

You can find messy ways to combine --[[ ]] and -- to get around this, but similarly, this can lead to some confusion and unnecessary bugs.

Luckily using these types of comments has been a luxury I’ve been able to live without, but it would have made my code a lot cleaner in some cases, if I had been able to properly nest comments.

Anyone who chooses not to use Renoise’s built-in scripting editor shouldn’t care too much, but I actually love to use it, and it is my primary editor for creating Lua tools for Renoise. This is such a small thing, I imagine it wouldn’t be very difficult to fix (correct me if I’m wrong @taktik).

TL;DR The highlighting of the deprecated --[[--[[ ]] ]] syntax for nested multi-line comments needs to be removed from Renoise’s built-in scripting editor, and highlighting of the current --[=[ ]=] syntax needs to be included instead.

1 Like

@Orangalang, perfectly explained and taktik will understand right away. I suppose he will be informed because you have appointed him. However, changes the title of this thread and puts something like “Error” somewhere.

This is such a lost issue within the code that it may take a long time to fix for being an unimportant detail. It also involves updating the API version to 6.2. I guess until he has a bunch of problems fixed he won’t change it. As far as I know, currently only taktik is in charge of solving these details.

1 Like

Yeah, it seems like taktik is the main force behind Renoise from what I can tell. I wouldn’t mind if he just decided to never fix this. He has a lot on his plate as it is, and Renoise has greater needs than fixing an issue like this, but I thought I should mention it in case it’s something he might not be aware of yet :slight_smile: thanks for your activity here on the forums as well, Raul :smiley: