Difference between revisions of "String.unpack"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2022.1<br/> '''Class:''' string<br/> === Description === Extracts the values packed in the provided binary string based on the de...") |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 5: | Line 5: | ||
=== Description === | === 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. | 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. | ||
− | < | + | <syntaxhighlight lang="lua"> |
(string) = string.unpack(format,data,start) | (string) = string.unpack(format,data,start) | ||
− | </ | + | </syntaxhighlight> |
=== Parameters === | === Parameters === | ||
− | '''format''': (string) format matching the one originally used to pack the string<br/> | + | '''format''': (string) format matching the one originally used to pack the string '''[[String.pack]]'''<br/> |
'''data''': (string) the packed strings<br/> | '''data''': (string) the packed strings<br/> | ||
'''start''': (string) byte at which the reading starts ('''optional, default = "1"''')<br/> | '''start''': (string) byte at which the reading starts ('''optional, default = "1"''')<br/> |
Latest revision as of 01:08, 18 October 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 String.pack
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