Skip to content
PeerHeer edited this page Dec 31, 2019 · 1 revision

Description

The listutils:unzip2 function unzips a list that contains sublists of length 2.

Usage

Input is given using the listutils:in storage:

Field Meaning
List The list to unzip.

After defining the input, run the function listutils:unzip2.

Errors

Errors that display when executing the listutils:unzip2 function as a player in debug mode.

Error Message
TBD TBD

Return values

Success

The success of the operation is stored in the $listutils.success listutils.out score. This score is 1 on success and 0 otherwise. The success is always 1 when not run in debug mode.

Result

The result of the operation is stored in the List and ZipList fields in the listutils:out storage and contains the unzipped lists. The List field will always contain the first elements of all sublists.

Example

Take the example list ExampleList: [["foo", "baz"],["Hello World!", "foo"],["foo", "bar"]]:

# Add Lists to the input.
data modify storage listutils:in List set from storage listutils:examples ExampleList
# Call the function.
function listutils:unzip2

This would return List: ["foo", "Hello World!", "foo"], ZipList: ["baz", "foo", "bar"] in the listutils:out storage.

Clone this wiki locally