britzl / defold-richtext

Defold-RichText is a system to create styled text based on an HTML inspired markup language
MIT License
75 stars 12 forks source link

Add a richtext.remove equivalent for characters #87

Open ChrisRegan opened 1 year ago

ChrisRegan commented 1 year ago

I just want to request the equivalent of the remove function to work with richtext.characters. Though adapting richtext.remove to work with characters would work as well.

britzl commented 1 year ago

Could you please be a bit more specific about exactly what you expect from such a function? Could you give an example of how it would be used and what the expected result is?

ChrisRegan commented 1 year ago

Well remove does this.

richtext.remove(words)

Removes all gui text nodes created by richtext.create() I was hoping for an equivalent for the same function for richtext.characters.

Since a similar existing function already existed I thought to ask for it.

Though my use case currently is that currently I get the result of create. And replace some of the words with the characters like:

Words = richtext.create("some sentence")

local temp = richtext.characters(Words[1]) richtext.remove(Words[1]) Words[1] = temp.

On cleanup I would like to do the same as

richtext.remove(Words) or a similar richtext.removeCharacters(Word[1])

to simplify cleanup. Probably easy to do manually but thought I should ask since a similar function already exists