Variadic determine number of inputs?

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

https://www.arduino.cc/en/Reference/SPITransfer

(Note, I’m self taught and not at all a very good programmer hence the nomenclature can take me a while to get / understand… But I am trying…)

Thanks

I have read this post +thread but it’s fairly complex for a novice dabbler like me

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.

Thanks very much @gweimer I’ll work my way through the library and see where I get to. FIFO will be fine for me / my application I believe (think)

I’ll try it and see