Add/Delete Characters In A Label? (SOLVED)



Working on the new high score name input screen now…
We have a blank label where the entered name will display.
As the user types or clicks we need to update the name label.
How would we add and delete individual characters in a label?
Let us know, thanks!



You need to save the current typed text in the script controlling the label.

It could be in self.typed_text

Then when the user types more you update the label text.

To add characters you can do for example

self.typed_text = self.typed_text .. character

To remove characters when user presses and releases or repeats backspace you can do

self.typed_text = self.typed_text:sub(1, -2)


Good stuff, thanks!