Actualize math, string, table helpers.

This commit is contained in:
Alexander Chibrikin
2026-02-02 04:59:11 +03:00
parent e21367325c
commit 1d0043bfe7
3 changed files with 47 additions and 2 deletions

View File

@@ -13,3 +13,41 @@ function string:split(separator, include_empty, max_splits, sep_is_pattern) end
--- e.g. `"\n \t\tfoo bar\t ":trim()` returns `"foo bar"`
--- @return string
function string:trim() end
--- Backported from Lua 5.4, see https://www.lua.org/manual/5.4/manual.html#6.4.2
---
--- Returns a binary string containing the values `v1`, `v2`, etc. packed (that
--- is, serialized in binary form) according to the format string `fmt`.
---
--- @param fmt string
--- @param v1 string
--- @param v2? string
--- @param ... string
---
--- @return string
function string.pack(fmt, v1, v2, ...) end
--- Backported from Lua 5.4, see https://www.lua.org/manual/5.4/manual.html#6.4.2
---
--- Returns the values packed in string `s` according to the format string
--- `fmt`. An optional `pos` marks where to start reading in `s` (default is 1).
--- After the read values, this function also returns the index of the first
--- unread byte in `s`.
---
--- @param fmt string
--- @param s string
--- @param pos? integer
---
--- @return any ...
--- @return integer offset
function string.unpack(fmt, s, pos) end
--- Backported from Lua 5.4, see https://www.lua.org/manual/5.4/manual.html#6.4.2
---
--- Returns the size of a string resulting from `string.pack` with the given
--- format. The format string cannot have the variable-length options '`s`' or '`z`'
---
--- @param fmt string
---
--- @return integer
function string.packsize(fmt) end