How do LastTouchId() and LastEndedTouchId() work?

Hi,

I’m having trouble figuring out how LastTouchId() and LastEndedTouchId() work. Do they pop and return an id from a queue/stack? Or is there some other underlying mechanism? I’m a bit confused, because in the online example their usage is slightly different to each other.

In the online example (image of the events below), ‘new touch’ is in a one off test, whereas the ‘touch ended’ is in a while loop. This seems to suggest that LastEndedTouchId() returns an id from a stack/queue, leaving the remainder of the touches for the next iteration of the loop. Would that mean the LastTouchId() returns the next id (if there is one) for each call to the scene events?

Can anyone confirm or correct this assumption?