1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-12-13 10:45:21 +01:00

Backport PUC Lua 5.4's string.{pack,unpack,packsize}

This commit is contained in:
Lars Müller
2025-12-08 23:19:24 +01:00
committed by GitHub
parent 98c6f786f8
commit 6daf3871e7
9 changed files with 568 additions and 0 deletions

View File

@@ -4228,6 +4228,11 @@ Helper functions
* e.g. `"a,b":split","` returns `{"a","b"}`
* `string:trim()`: returns the string without whitespace pre- and suffixes
* e.g. `"\n \t\tfoo bar\t ":trim()` returns `"foo bar"`
* Utilities for working with binary data:
* `string.pack(fmt, ...)`
* `string.unpack(fmt, s, [pos])`
* `string.packsize(fmt)`
* Backported from Lua 5.4, see https://www.lua.org/manual/5.4/manual.html#6.4.2
* `core.wrap_text(str, limit, as_table)`: returns a string or table
* Adds newlines to the string to keep it within the specified character
limit