Clarify pcall usage and ustring_to_line_array behavior

This commit is contained in:
Mikita Wiśniewski 2025-02-03 19:06:39 +07:00
parent 8374270831
commit f8d4b994ff
2 changed files with 2 additions and 0 deletions
mods/ITEMS/mcl_signs

View file

@ -44,6 +44,7 @@ _UTF-8 strings_, or _u-strings_ for short.
* Converts a u-string to string. Used for displaying text in sign formspec
* `mcl_signs.ustring_to_line_array(ustr)`
* Converts a u-string to line-broken list of u-strings aka _a line array_
* Behavior on line overflow is controlled by the `mcl_signs_wrap_mode` enum
* `mcl_signs.generate_line(ustr, ypos)`
* Generates a texture string from a u-string for a single line using the
character map

View file

@ -167,6 +167,7 @@ local function string_to_ustring(str, max_characters)
local ustr = {}
-- pcall wrapping to protect against invalid UTF-8
local iter = utf8.codes(str)
while true do
local success, i, code = pcall(iter)