I want to remove last line of string in Roblox. However the method I am using now is slow and string gets too long (string is too long error) after few uses. The code:
local str = "I will be the last line of string\nI am the last line of string now\n"
local tab = str:split("\n")
for i = 1, 2 do
table.remove(tab, #tab)
end
print(tab[#tab])
Thanks for help.
Also note that my string always ends with new line.