Page MenuHomePhabricator

Multiline comments unexpectedly ends.
Closed, InvalidPublic

Description

I had some code that looked a little like this:

local s = "some string"..
		"[[" .. "some link" .. "]]" ..
	  "some string"

trying to comment out this whole thing doesn't really work - then multiline comment ends at the second line, despite the fact that the ]] are in a string.

Event Timeline

elyashiv raised the priority of this task from to Needs Triage.
elyashiv updated the task description. (Show Details)
elyashiv added a project: Scribunto.
elyashiv subscribed.
Anomie claimed this task.
Anomie subscribed.

This is how comments work: everything until the end-delimiter is part of the comment, regardless of whatever potential syntax might exist were the comment interpreted as code.

You can use alternative comment delimiters such as --[=[ ... ]=], --[==[ ... ]==], and so on to avoid this issue.