From 6e8dc59e33da2b0e4166d64e43d720e058f6b801 Mon Sep 17 00:00:00 2001 From: GDN <96800819+GDNgit@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:35:05 -0600 Subject: [PATCH] Disallows using list operators in strings in the contributing document (#23307) --- .github/CONTRIBUTING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 545ec24266d..cdd04e32c36 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -163,6 +163,22 @@ eg: `/datum/thing`, not `datum/thing` In DM, this is optional, but omitting it makes finding definitions harder. To be specific, you can declare the path `/arbitrary`, but it will still be, in actuality, `/datum/arbitrary`. Write your code to reflect this. +### Do not use list operators in strings + +The use of list operators to augment strings is not allowed. This is roughly 10 times slower than using a list with a Join() Function. + +```dm +//Bad +var/text = "text" +text += "More text" +to_chat(world, text) + +//Good +var/list/text = list("text") +text += "More text" +to_chat(world, text.Join("")) +``` + ### Do not use text/string based type paths It is rarely allowed to put type paths in a text format, as there are no compile errors if the type path no longer exists. Here is an example: