多文本选择
Pick one of several stacked text inputs by index
- i
- textList
- text0
- text1
- STRING
- LIST
MultiTextSelelct ("多文本选择", multi-text select) is a small selector: you wire up a handful of text inputs, set an index, and it hands back the string at that position plus the whole collected list. Note the spelling - "Selelct" - that's the pack's typo, and it's what you'll search for. You got here because the node literally has that name.
The use case is the one ComfyUI is full of: you have several prompt variants (or filename stems, or LoRA trigger phrases) and you want to pick between them at runtime instead of editing the graph. Feed it a seed or a counter on the i input and the same workflow can walk through variants without you touching the canvas. The output list is a bonus - you get all the collected texts back as a LIST even when you only asked for one.
How it works
Two ways to feed it. You can pass a textList in (a LIST from, say, LongTextToList), or you can wire individual text0, text1, ... inputs - the node gathers whatever text slots are connected and appends them to the list. Then i indexes into the combined result. So it plays both roles: index-into-a-list, and collect-scattered-texts-into-a-list, with the selected element on one output.
One caveat from the implementation: it filters to string values when collecting slots, so a non-string wired into a text input gets skipped silently. And if i is out of range, it throws - a dead queue, not a graceful fallback.
The inputs and outputs
i(NUMBER, INT) - the index of the text you want back.textList- optional; a prebuilt list to select from.text0,text1, ... - optional; individual text slots that get collected into the list.- Outputs:
STRING(the element at indexi) andLIST(the full collected list).
That's the whole node. One number in, one string and one list out.
Installing it
It's part of the ComfyUI_Lam pack. Install via ComfyUI Manager (search "ComfyUI_Lam") or:
cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam
Restart, and it's in the lam category. No models, no heavy dependencies - this is pure list logic, so you can use it without ever touching the pack's README install ritual (the bundled rars and the ancient pinned pip requirements that are aimed at the face/inpainting nodes).
Common issues
The out-of-range index is the thing that bites. Unlike a switch that falls back to a default, this node crashes the queue when i doesn't line up with what you wired in. If you're driving i from a seed, clamp it to the length of your list - the 数组长度 output from LongTextToList exists for exactly this reason.
Also don't expect the individual textN slots and a wired textList to behave like an OR - anything connected gets collected and indexed in connection order, so it's easy to get an off-by-one if you mix both. Keep it simple: either feed one list, or feed slots, not a mix.
The usual pack-level notes apply: this is a Chinese-language node from a pack with almost no community footprint, and if you uninstall ComfyUI_Lam at some point, delete ComfyUI/web/extensions/lam as well - the pack's frontend extension can leave a popup behind that persists after the pack is gone.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| i | NUMBER,INT | — | |
| textListopt | LIST | — | |
| text0opt | TEXT,STRING | — | |
| text1opt | TEXT,STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |
| LIST | LIST | — |