Issue Detecting Line Breaks

Hello! I need help detecting line breaks, since methods like string.split(string, “/n”) or string:split("/n") would not work. An example of this is:

String = [[line 1
line 2
line 3]] -- example string

NewString = string.split(String, "/n") -- returns a table containing String itself

-- for testing the output yourself
for _, subString in pairs(NewString) do
print(subString)
end

(I read from Strings that line breaks in strings are usually marked by /n)
Output (If you tested in studio):
image
(sorry for the low quality image)
Be aware that all the output was all in one statement, which means it wasn’t separated.

3 Likes

It is \n, not /n. You are using a slash, not a backslash.

5 Likes

thank you for the response! i usually get confused with slash and backslash, sorry for wasting your time

4 Likes