文本列表选择
Pull one string out of a list, by index
- text_list
- STRING
TextListSelelct (文本列表选择, "text list select") is about as small as a node gets: it takes a LIST of strings and an index, and returns the string at that index. That's it - no models, no state, no hidden features. (Yes, "Selelct" is the typo in the class name. The pack is a one-man Chinese project and it shows in places like this. It doesn't affect anything.)
Why you'd bother
Because somewhere in your workflow you probably have a list of strings and no clean way to pick one. Anything that produces a LIST - a batch of prompt variations, a set of names, lines read from a file - can feed TextListSelelct. Feed the i input from a counter node, a seed, or a fixed widget, and you've got prompt cycling without building a switch. In a loop it's the natural "give me entry N of the batch" node.
The inputs:
text_list- the LIST of strings. It's markedforceInput, so it expects a wire, not a typed value.i- the index, INT, default 0, range 0–99999.
The single output is a STRING - the element at text_list[i].
The one footgun
Out-of-range indexes raise an IndexError, full stop. There's no wrap-around and no clamping. If your loop counter can drift past the end of the list, the workflow dies mid-run with a Python traceback. In practice: make sure whatever drives i stays inside len(text_list), or give it headroom. An empty list has nothing to select, which is the same failure one step earlier.
Installing it
Part of the ComfyUI_Lam pack. Install via ComfyUI Manager (search "ComfyUI_Lam") or clone:
cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam
Restart ComfyUI. No extra models, no downloads - this node uses nothing beyond Python built-ins, so it works even if the pack's heavier dependencies fail to install (a small mercy in a pack whose requirements.txt includes tensorflow).
Troubleshooting
An IndexError is the entire failure surface here. Everything else is passthrough: in goes a list and an index, out comes a string. If the output looks wrong, check the index - that's the only knob. If you need to select multiple entries at once, this isn't the node; look for the pack's MultiTextSelelct instead.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| i | INT | 00–99999 | — |
| text_list | LIST | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |