Yotsuba Games
Back to Node List

List Enumerate

list_enumerate

Pairs each list or palette element with its index

Reviewed
Guide available
The node name and summary are available in English. Port, parameter, and article details are currently shown in Japanese.

Input Ports

NameTypeDescription
ใƒชใ‚นใƒˆ
list
Any
Required
ๅˆ—ๆŒ™ใ™ใ‚‹ๅ…ƒใฎใƒชใ‚นใƒˆใพใŸใฏใƒ‘ใƒฌใƒƒใƒˆใงใ™

Output Ports

NameTypeDescription
ๅˆ—ๆŒ™็ตๆžœ
entries
List<Map>
{ index, item } ใฎใƒžใƒƒใƒ—ไธ€่ฆงใงใ™
่ฆ็ด ๆ•ฐ
count
Int
ๅˆ—ๆŒ™ใ—ใŸ่ฆ็ด ๆ•ฐใงใ™

Overview

Adds an index to every element in a list. In downstream list_map / list_filter expressions, the original value is available as item_item and the stored index as item_index.

Usage tips

  • In fact, list_map / list_filter already expose index for a raw list, so this node is unnecessary in many cases. Insert it when you want to retain the indexed Map structure itself downstream, such as for debug display or repeated use.
  • Write index-based conditions such as "even positions only" or "everything but the first" directly in a list_filter expression (for example, index % 2 == 0).

Related nodes

  • list_map / list_filter โ€” destinations that use the index (their expressions also provide index)
  • list_zip โ€” pair two lists by index
  • list_slice โ€” extract an index range

Read this first

  • This node adds the element's position to each original value.
  • It is commonly used when a downstream List Map or List Filter needs index.

Start with this example

Suppose the input list is:

["red", "blue", "green"]

Then entries is:

[
  { "index": 0, "item": "red" },
  { "index": 1, "item": "blue" },
  { "index": 2, "item": "green" }
]

count is:

count = 3

How downstream nodes see it

When these entries go into List Map or List Filter, every element is a Map. Their expressions can use:

  • item_item: the original value inside the Map
  • item_index: the index stored inside the Map by Enumerate
  • index: the current position in the outer list being processed by List Map/Filter

Immediately after Enumerate, item_index and index normally have the same number, but they represent different things.

Examples:

item_item + item_index
index % 2 == 0

When to use it

  • When you want to number candidates for debugging
  • When you want to branch on an index
  • When you need to distinguish the stored item_index from the outer index

Notes

  • Each element retains its type, so item contains the original value as-is.
  • A Palette input is enumerated as List<Color>.
Back to Node List
List Enumerate โ€” PixPipeline Node Reference