in reply to Help with node discovering and processing
If so, I would just declare a global counter to be incremented whenever you need. I think that this is a case where a global variable makes sense. If you really don't want a global variable, then you could use a closure maintaining that counter private to it and either doing the print job or returning the value of the (incremented) counter on demand. But it sounds a bit as overkill in the case.
Edit: Thinking about it, using a static variable (the relatively new state keyword), for example within a callback function, might be another way to go.
|
|---|