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

Usage

Finding the length of a list can be done with the data get command combined with execute store result, which is built-in and not used by List Utils. For dynamic uses, you can use data get storage|block|entity <identifier> <path>.

Errors

Errors that display when executing the command from chat.

Error Message
Element does not exist Found no elements matching <element>
Objective does not exist Unknown scoreboard objective '<objective>'

Return values

The value returned using execute store result represents either the value of the element for numeric values, or the length of the element for all other values.

Example

Take the example list ExampleList: ["foo", "Hello World!", "foo", "bar"] in the listutils:examples storage. We want to find its length and store it in the $length lenghtObj score:

execute store result score $length lengthObj run data get storage listutils:examples ExampleList

This will result in a $length lenghtObj score of 4.

External links

Clone this wiki locally