Nodes/ComfyUI LC123 Nodes/LC Any Index Switch
ComfyUI Node

LC Any Index Switch

Pick input #4 of 6 with one number, whatever the type

By lonecatone23·Created 2 months ago·Updated 3 days ago· 18
LC Any Index Switch
  • any_01
  • any_02
  • any_03
  • any_04
  • any_05
  • any_06
  • any_07
  • any_08
  • any_09
  • any_10
  • any_11
  • any_12
  • any_13
  • any_14
  • any_15
  • any_16
  • any_17
  • any_18
  • any_19
  • any_20
  • *
index0
inputcount2

ComfyUI's type system is mostly strict, but it has one escape hatch: the wildcard type, *, which accepts anything. LC Index Switch is built on it - up to 20 inputs of any type, and it passes through whichever one an integer index points at. Model, latent, image, prompt string, doesn't matter. It's the "which of these N things is live right now" node for when a simple A/B toggle isn't enough.

How it works

You get an index widget (0-based, so slot 1 is index 0 - the eternal footgun), an inputcount (2 to 20) that controls how many any_01any_20 slots appear, and a single wildcard output. The logic is a pass-through: whatever is connected to the slot at your index comes out the other side. It clamps the index into range, so an out-of-bounds value quietly points at the last slot instead of erroring. If nothing is connected to that slot, you get None downstream - which is a feature if your downstream nodes tolerate it, and a bug if they don't.

The intended pairing is with the pack's LC Custom Combo: convert the index widget to an input (right-click → Convert Widget to Input) and wire the combo's index output into it, and you've got a dropdown that routes between presets without touching a single wire. That's the "programmable graph" pattern from the plumbing layer - a selector that's data, not hand-editing.

What to actually set

  • inputcount - how many options you need. Don't leave it at 20; unused wildcard slots invite you to connect the wrong one.
  • index - the slot to pass through. Remember it's zero-based, so "the second model" is index 1.
  • Convert index to an input the moment you want it driven by anything else - another node, a seed, a math result.

Install

Ships in ComfyUI LC123 Nodes (MIT, 89 nodes). ComfyUI Manager → search "ComfyUI LC123 Nodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/lonecatone23/ComfyUI_LC123_nodes

Restart. Zero extra dependencies. On managed cloud hosts, the platform installs it for you on request.

The honest caveat

Wildcard switches are the "Anything Anywhere" trap's smaller cousin: they make graphs easy to wire and harder to read, because the type system can't tell you that slot 3 is a latent and slot 4 is a string. Keep inputcount tight and you get the flexibility without the spaghetti. If you only ever need one of two things, use a typed A/B switch instead - you lose nothing and gain a checker that will yell at you when the types mismatch.

CategoryLC123/utils

Inputs (22)

NameTypeDefaultDescription
indexINT00–190-based slot. Right-click → Convert Widget to Input to wire INDEX here.
inputcountINT22–20
any_01opt*
any_02opt*
any_03opt*
any_04opt*
any_05opt*
any_06opt*
any_07opt*
any_08opt*
any_09opt*
any_10opt*
any_11opt*
any_12opt*
any_13opt*
any_14opt*
any_15opt*
any_16opt*
any_17opt*
any_18opt*
any_19opt*
any_20opt*

Outputs (1)

NameTypeDescription
**