1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-30 19:22:14 +00:00

Add core.strip_escapes() (#16485)

This commit is contained in:
sfan5 2025-09-14 23:01:43 +02:00 committed by GitHub
parent cc6b56b034
commit d932f34693
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 52 additions and 17 deletions

View file

@ -3920,10 +3920,8 @@ The following functions provide escape sequences:
* `color` is a ColorString
* The escape sequence sets the text color to `color`
* `core.colorize(color, message)`:
* Equivalent to:
`core.get_color_escape_sequence(color) ..
message ..
core.get_color_escape_sequence("#ffffff")`
* Equivalent to including the right color escape sequence in the front,
and resetting to `#fff` after the text (plus newline handling).
* `core.get_background_escape_sequence(color)`
* `color` is a ColorString
* The escape sequence sets the background of the whole text element to
@ -3934,6 +3932,10 @@ The following functions provide escape sequences:
* Removes background colors added by `get_background_escape_sequence`.
* `core.strip_colors(str)`
* Removes all color escape sequences.
* `core.strip_escapes(str)`
* Removes all escape sequences, including client-side translations and
any unknown or future escape sequences that Luanti might define.
* You can use this to clean text before logging or handing to an external system.
Coordinate System