Skip to content
PeerHeer edited this page Dec 31, 2019 · 10 revisions

Usage

Extending a list with another list can be done using the data modify command, which is built-in. For dynamic uses, you can use data modify storage|block|entity <identifier> <path> append from storage|block|entity <identifier> <path>[] (note the square brackets in the second path).

Errors

Errors that display when executing the command from chat.

Error Message
Invalid type Nothing changed, the specified properties already have these values
Not a list Expected list, got: <value>

Return values

execute store result returns the amount of lists that were modified using this operation.

Example

Take the example lists ExampleList: ["foo", "Hello World!", "foo", "bar"] and ExtendList: ["baz", "foo", "bar"] in the listutils:examples storage. We want to extend ExampleList with ExtendList:

data modify storage listutils:examples ExampleList append from storage listutils:examples ExtendList[]

This will result in the list ExampleList: ["foo", "Hello World!", "foo", "bar", "baz", "foo", "bar"].

External links

Clone this wiki locally