mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
add unpack function documentation
This commit is contained in:
parent
ee26b2a2b9
commit
72394181c7
3 changed files with 15 additions and 13 deletions
|
|
@ -39,6 +39,12 @@ Value characters describe the type and size.
|
|||
> [!WARNING]
|
||||
> Due to the absence of an integer type in Lua for values `l` and `L`, only an output size of 8 bytes is guaranteed; the value may differ from what is expected.
|
||||
|
||||
```lua
|
||||
byteutil.unpack(format: str, bytes: table|Bytearray) -> ...
|
||||
```
|
||||
|
||||
Extracts values from a byte array based on a format string.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
|
|
@ -58,14 +64,7 @@ debug.print(byteutil.tpack('>iBH?', -8, 250, 2019, true))
|
|||
-- )
|
||||
|
||||
local bytes = byteutil.pack('>iBH?', -8, 250, 2019, true)
|
||||
debug.print(byteutil.unpack('>iBH?', bytes))
|
||||
print(byteutil.unpack('>iBH?', bytes))
|
||||
-- outputs:
|
||||
-- debug.print(
|
||||
-- {
|
||||
-- -8,
|
||||
-- 250,
|
||||
-- 2019,
|
||||
-- true
|
||||
-- }
|
||||
--)
|
||||
-- -8 250 2019 true
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue