
The text in the picture consists of 2 lines and I want to get only the 1st line

The text in the picture consists of 2 lines and I want to get only the 1st line
local TestString = "Line1\nLine2" -- Could also use brackets [[]]
local Lines = TestString:split("\n")
print(Lines[2])
i have a lot of solutions for that but the one that i see more useful is splitting the text in new lines which are these characters:“\n”
local str = "Text1\nText2" -- the text
local textLines = str:split("\n") -- this returns a table of all the text splitted
print(textLines[1]) -- first text
I thought “\n” didn’t work anymore. Thank you.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.