Difference between revisions of "love.data.unpack"
(Created page) |
m |
||
Line 1: | Line 1: | ||
− | {{newin|[[ | + | {{newin|[[11.0]]|110|type=function}} |
Unpacks (deserializes) a byte-string or Data into simple Lua values. | Unpacks (deserializes) a byte-string or Data into simple Lua values. | ||
Latest revision as of 22:35, 1 April 2018
Available since LÖVE 11.0 |
This function is not supported in earlier versions. |
Unpacks (deserializes) a byte-string or Data into simple Lua values.
This function behaves the same as Lua 5.3's string.unpack.
Contents
Function
Synopsis
v1, ..., index = love.data.unpack( format, datastring, pos )
Arguments
string format
- A string determining how the values were packed. Follows the rules of Lua 5.3's string.pack format strings.
string datastring
- A string containing the packed (serialized) data.
number pos (1)
- Where to start reading in the string. Negative values can be used to read relative from the end of the string.
Returns
value v1
- The first value (number, boolean, or string) that was unpacked.
value ...
- Additional unpacked values.
number index
- The index of the first unread byte in the data string.
Function
Synopsis
v1, ..., index = love.data.unpack( format, data, pos )
Arguments
string format
- A string determining how the values were packed. Follows the rules of Lua 5.3's string.pack format strings.
Data data
- A Data object containing the packed (serialized) data.
number pos (1)
- 1-based index indicating where to start reading in the Data. Negative values can be used to read relative from the end of the Data object.
Returns
value v1
- The first value (number, boolean, or string) that was unpacked.
value ...
- Additional unpacked values.
number index
- The 1-based index of the first unread byte in the Data.
Notes
Unpacking integers with values greater than 2^52 is not supported, as Lua 5.1 cannot represent those values in its number type.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info