Files
plainleaf/client
Matouš Jan FialkaandGitHub fd4ff8518d [Space Lua] Implement string.pack, string.unpack and string.packsize (#1851)
The three binary-packing functions from Lua are now implemented in
a dedicated `string_pack.ts` module and wired into `stringApi`.

Format parsing follows the exact option set of Lua:

* signed and unsigned integers of configurable width
  (`b`/`B`/`h`/`H`/`l`/`L`/`j`/`J`/`T`/`i`/`I`),
* IEEE 754 single and double precision floats (`f`/`d`/`n`),
* fixed-length strings (`c`),
* length-prefixed strings (`s`),
* zero-terminated strings (`z`),
* padding bytes (`x`),
* alignment padding (`X`), and
* endianness/alignment modifiers (`<`/`>`/`=`/`!`).

`string.packsize` rejects variable-length formats (`s` and `z`) as Lua
requires.

`string.unpack` returns all unpacked values followed by the
next position integer, matching the Lua contract exactly.

Test suite extended in separates `string_pack_test.lua` file. Passes
both Lua and Space Lua execution.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-02-25 09:29:14 +01:00
..
2025-09-19 13:23:20 +02:00
2026-01-31 17:07:35 +01:00
2025-09-19 13:23:20 +02:00
2025-10-22 15:35:37 +02:00
2025-09-19 13:23:20 +02:00
2026-01-07 11:00:32 +01:00
2026-01-29 11:07:28 +01:00
2025-10-31 09:13:24 +01:00
2025-10-31 09:13:24 +01:00
2025-09-19 13:23:20 +02:00
2025-09-19 13:23:20 +02:00
2025-09-19 13:23:20 +02:00
2025-09-29 15:30:38 +02:00
WIP
2026-01-20 13:48:15 +01:00

SilverBullet-specific code that is shared between server and client