the facility for putting "arbitrary" number of = signs in long string delimiters is NOT made for escaping arbitrary code from random sources.
It is only a facility for commenting source programs.
Don't abuse it! If you need to espace properly data without huge cost, it's just enough to use a small number of = signs (not more than 5 should be enough) and then escape only the occurences of 5 equal signs by breaking it after the 4th one occuring after a ] and if it's followed by a ]. This is a rare case in actual data.
you'd output [====[=========]
To encode "====]",
you'd output [====[====]]====]
To encode "]====]" (this is one of the worst case scenarii),
you'd output [========]====][========]
I.e. close the current delimiter and reopen it immediately. This should create a single string, just like "ABC====""=ABC".
Allowing string literals (using either short or long delimiters) to be repeated without any operator between them, should be parsed as a single literal value (and you could as well mix the quotation styles between each part, this should not change at all the meaning). No change is needed in the Lua lexer, the only change is in the parser: accept "A" "B" to represent the same literal value as "AB" (the spaces between the two parts could as well be newlines, without needing to use an intermediate + operator which would be evaluated at runtime.
The interest of the "long quotation" marks is that it can occur much less often so the escaping worstcase encoded length is better with delimiters that are 6 character long like here instead of just 1-character long. But you'll realize immediately that the worst case always exists and the its total encoded length is now a bit longer than single character escaping (the increase is only in the first leading and last trainling delimiter, but not in the middle part whose size is doubled by adding the escapes.
But the worst case will most likely just occur less often (it occurs only when encoding source sequences containing ONLY an exact repetition of the trailing delimiter.