I am trying to create a node to act as a buffer of unknown length using a Variadic-1 node… Problem is… Is there a way to know the number of inputs?
Trying to create a node for SPI.transfer(buffer,size)… And I’d like to know the size of the buffer (given I was hoping to create a variadic buffer node
I think the gist of the discussion is that you can’t know the # of variadic inputs, but you can discover which pin you are currently on (which gives you total when on your last pin, but you don’t know it is the last pin). To get the “current” pin number, you need to have “fake” input/output pins; add 1 to the fake input & feed it to the fake output. I requested method to get this info (like output pins on variadic node for current level & #pins), but it has not yet been provided.
gweimer/utils library has examples of buffers. running-avg uses variadic like you are suggesting (see example nodes for usage). It only works for FIFO-style buffer (First In, First Out). If you want a stack (Last In, First Out), you need to be able to push data both directions & I don’t think variadic can handle that.