0 votes


I have seen a post on this forum discussing this problem, but his/her solution isn't clear to me due to the reason that the link he provided isn't online anymore.

Is there any way to get the last line of a Label?

Thanks in advance.

asked Aug 29, 2017 in Engine by Chain (71 points)
reshown Nov 25, 2017 by Akien

1 Answer

+1 vote
Best answer

Well one way is take the string and split it by newline character. Take the last element of the array it creates.

var s_arr = label.get_text().split("\n")
print(s_arr[s_arr.size() -1])
answered Aug 29, 2017 by avencherus (4,811 points)
selected Nov 25, 2017 by Akien

That was it, thank you!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.