Don't use [[strings]]
Unit defs seem to have a convention where strings use [[this]] notation instead of "this" one or 'that' one. This causes problems when inexperienced modders try to work with those files. Consider:
weapons = {
--[[ Let's comment out this lame weapon and add my own!
{
def = [[LAZOR]], -- acuelly ends here
foo = 123,
bar = [[BAZ]],
},
]] -- Surely this is where my comment ends!
}
This is made especially bad by the fact that many syntax highlighters (in particular Notepad++) seem to get it wrong. The task is to find [[strings]] and convert them to "strings".
The only difference of [[ is multi-line strings, which isn't actually needed anywhere we use [[.
local x = "multi\nline\nstring" -- ugly
local y = "multi\n"
.. "line\n" -- has to concatenate so CPU/GC pressure, also still ugly
.. "string\n"
local z = "multi -- nope, syntax error, also this comment is actually part of the string
line
string"
local a = [[multi
line
string]]
Unless there are edge cases that I'm unaware of, fixing this for non multi-line strings should be as simple as using the following regex: \[\[([^[]+)\]\] replacing the group with "$1"
But merging/reviewing the subsequent PR with ~20k changes in 500+ files will be a pain.