Nodes/ComfyUI_MieNodes/Mie Loop Param Get Int ๐Ÿ‘
ComfyUI Node

Mie Loop Param Get Int ๐Ÿ‘

Read the current loop value as an INT

By MieMieeeeeยทCreated 2 years agoยทUpdated 27 days agoยท 225
Mie Loop Param Get Int ๐Ÿ‘
  • loop_ctx
  • INT
โ—„keyvalueโ–บ
โ—„default_value0โ–บ

This is how the body of your loop actually gets the value it's supposed to work on. MieLoopStart sets up the sequence and carries each pass's value inside the loop_ctx; MieLoopParamGetInt reaches into that context and pulls the value out as a plain INT so you can wire it into a sampler's steps, a seed, a batch count, a loop over frame numbers - anything that wants an integer.

Part of ComfyUI-MieNodes (ComfyUI_MieNodes), MieMieeeee's utility pack, under the ๐Ÿ‘ Loop submenu.

How it works

The loop context is a little key/value bag. Each iteration, the current item lives under a key - by default value - and MieLoopParamGetInt looks that key up and returns it typed as an integer. Point it at a loop running in int mode and leave the key at its default, and you get "the current number this pass." Point it at a different key and you can read any integer you stashed in the state bag via MieLoopStart's initial_state_json or written back through MieLoopEnd's state_json.

The inputs and outputs that matter

  • loop_ctx (MIE_LOOP_CTX) - the context from the loop.
  • key (STRING, default value) - which entry to read. Leave it at value for the primary iterated number; set it to a custom name to read something else you put in the state.
  • default_value (INT, default 0) - what you get back if that key isn't present. This is your safety net: no missing-key crash, just the fallback.
  • Output INT - the integer for this pass.

The default-value input is the quietly useful part. In the first iteration of a loop, or before you've written a given key, the fallback keeps things flowing instead of erroring.

Installing it

ComfyUI Manager โ†’ search ComfyUI-MieNodes โ†’ install โ†’ restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes

then restart. No model downloads or heavy dependencies for the loop nodes. It's under ๐Ÿ‘ MieNodes โ†’ ๐Ÿ‘ Loop.

Common issues

I always get the default_value back. The key doesn't match what's in the context. If you're after the iterated number, key should be value and the loop's param_type should be int. If you're reading a custom state entry, the name has to match exactly - it's case-sensitive.

Wrong type. This node returns an INT. If your loop is running over floats, strings, or JSON, grab the matching getter instead: Float, String, or read structured data as a string and parse it. Asking for an INT from a float loop will not give you what you expect.

Just need the counter, not the value. If you want the iteration number rather than the payload, MieLoopGetIndex is the more direct node.

Category๐Ÿ‘ MieNodes/๐Ÿ‘ Loop

Inputs (3)

NameTypeDefaultDescription
loop_ctxMIE_LOOP_CTXโ€”
keySTRINGvalueโ€”
default_valueINT0โ€”

Outputs (1)

NameTypeDescription
INTINTโ€”