Difference between revisions of "String.unpack"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
m (Text replacement - "</source>" to "</syntaxhighlight>")
Line 7: Line 7:
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
(string) = string.unpack(format,data,start)
 
(string) = string.unpack(format,data,start)
</source>
+
</syntaxhighlight>
  
 
=== Parameters ===
 
=== Parameters ===

Revision as of 14:33, 13 July 2023

Available since: Gideros 2022.1
Class: string

Description

Extracts the values packed in the provided binary string based on the description in the first argument. The description should match the one originally used to pack the string. The optional third parameter determines the byte at which the reading starts.

(string) = string.unpack(format,data,start)

Parameters

format: (string) format matching the one originally used to pack the string
data: (string) the packed strings
start: (string) byte at which the reading starts (optional, default = "1")

Return values

Returns (tuple) the values packed into the provided binary string, plus the index of the first unread byte