Nodes/ComfyUI_Eclipse/String from List
ComfyUI Node

String from List

Pick a string by index β€” with wrap-around and a size report

By r-vageΒ·Created 10 months agoΒ·Updated a day agoΒ· 31
String from List
    • list item
    • size
    • wraps
    β—„list_inputβ€”β–Ί
    β—„index0β–Ί

    ComfyUI hands you lists all the time - a batch of filenames, a list of prompts, a stack of wildcard expansions - but the core nodes are weirdly thin on "give me item number three." String from List fills that gap: feed it a list of strings and an index, and it returns the item at that position. The useful part is the wrap-around: indexes beyond the end of the list loop back to the start instead of erroring, so you can step through a list indefinitely without ever hitting a crash.

    The mechanism is small but thoughtful. The list_input is a string (which can be a list of strings), the index is an integer that supports wrap-around, and the outputs tell you everything you might need:

    • list item - the selected string, returned as a list (so downstream list handling just works).
    • size - the number of items in the list. Handy for bounds logic or iterating.
    • wraps - how many times the index wrapped around the end. Zero means you're inside the list; a positive value means you looped.

    That wraps output is the quiet gem - it lets downstream logic know you've cycled back to the start, which matters if you're using this for looping through a fixed set of prompts and want a "new lap" signal to trigger something else.

    Where it fits

    Two classic uses. First, cycling: drive index from a counter or seed and step through a list of prompts or negative blocks, one per run. Second, batch selection: pick a specific item out of a generated list without splitting anything yourself. Because the output is a list-type string, it chains into any node expecting a list of strings.

    Installing it

    Part of ComfyUI_Eclipse, no dependencies:

    git clone https://github.com/r-vage/ComfyUI_Eclipse custom_nodes/ComfyUI_Eclipse
    

    Or ComfyUI Manager β†’ search "ComfyUI_Eclipse" β†’ install and restart.

    Gotchas

    The wrap-around is a feature, but it's also the thing that will surprise you: an out-of-range index won't fail, it'll silently wrap - so if you expected an error to catch a bug, you won't get one. That's exactly why the wraps output exists; check it if "why is this the same item again?" ever confuses you. And remember the list comes from list_input at execute time, so it's a snapshot, not live. Pack note: pre-v4.0.0 RvTools-era node IDs need the migration tool on old workflows; fresh ones load fine.

    CategoryπŸŒ’ Eclipse/ Conversion

    Inputs (2)

    NameTypeDefaultDescription
    list_inputSTRINGList of strings to select from.
    indexINT0-999–999Index to select (supports wrap-around).

    Outputs (3)

    NameTypeDescription
    list itemSTRINGβ€”
    sizeINTβ€”
    wrapsINTβ€”