IndexesOfList
IndexesOfList – ComfyUI Node
- lst
- lst
What it is
IndexesOfList is the plural cousin of this pack's IndexOfList: instead of pulling out one element by one index, it pulls out several elements by several indices at once, specified as a comma-separated string. If you've got a list of ten batch results and you only want elements 0, 3, and 7, this is the node - no loop, no separate filter logic, just tell it which positions you want and it hands back that subset as a new list.
This is squarely a data-pipeline node rather than an image node. You'll use it wherever you're managing lists directly - batch metadata, a set of file paths, results collected across a loop - and need to cherry-pick specific positions out of that list rather than processing every element.
Inputs and outputs
lst(type*, required) - the source list. Typed as*rather than strictlyLIST, so it'll accept whatever list-shaped thing an upstream node hands you.index(STRING, default"0") - the positions you want, as a string. The description notes it supports comma-separated values, so something like"0,2,5"to pull three specific elements at once.
One output: lst (type *) - the filtered subset, in whatever order your index string specified.
How it works
Parse the index string into a list of integer positions, then build a new list from just those positions in the source list. Because index is a plain string rather than a structured input, the exact syntax matters - comma-separated is what's documented, so stick to plain numbers separated by commas without extra spaces unless you've confirmed the parser tolerates them.
Installing it
Comes with comfyui-easyapi-nodes. Through ComfyUI Manager: search "comfyui-easyapi-nodes", install, restart ComfyUI. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
cd comfyui-easyapi-nodes
pip install -r requirements.txt
This node is plain list indexing with no special dependency, but running the requirements install keeps the rest of the pack functional - several other nodes in it do need extra packages. git pull in the folder later to upgrade.
Common issues
"I got an error or an unexpectedly short list back." Check that every index in your comma-separated string is actually within range for the source list - an out-of-bounds index in the mix is the likely culprit, and unlike IndexOfList (which explicitly returns None for an out-of-range single index), it's worth testing what this node does with a partially-invalid index string before relying on it in a pipeline where that could happen unpredictably.
"My index string isn't parsing the way I expect." Stick to the documented format: plain integers separated by commas, e.g. "0,2,5". If you're building that string dynamically (say, from a math or string-concatenation node upstream) rather than typing it by hand, print it through a debug/show node first to confirm it actually looks like "0,2,5" and not something with extra whitespace, brackets, or a different separator that the parser wasn't built to handle.
"I only need one element, not several." Reach for IndexOfList instead - it takes a plain integer widget rather than a string to parse, which is simpler and less error-prone when you genuinely only need a single position.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| lst | * | — | |
| index | STRING | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| lst | * | — |