ReturnStack
ReturnStack
Stack | Position | Description |
---|---|---|
Stack(In) | Top | any |
Top 1 | ... | |
Stack(Out) | Top | - |
This instruction enables the receiver of a message to return values to the sender. ReturnStack takes all entries from the stack to copy them as return value(s) to the sender's stack after the triggering SendMsg statement is completed.
Attention: ReturnStack does not interrupt the processing of the current message. If this is desired, then the combination ReturnStack return
Note: ReturnStack is only useful in response to a message!
Example:
Calling module: An object is placed on the stack and the message is called.
Module that receives the message. Before the end of the execution list of this message, ReturnStack indicates that the current stack is retained:
If a message is handled by several modules / widgets, then ReturnStack can be used to deliver the individual results collected to the caller of SendMsg.
Example
Channel | Receiver A | Receiver B |
---|---|---|
SendMsg(GET_NUMBER) + //-> 3 should be on stack | GET_NUMBER: 1 ReturnStack | GET_NUMBER: 2 ReturnStack |
The sender sees the combined ReturnStack of both receivers as the result. If there are several recipients, the message is sent to all recipients sequentially, whereby the order (and thus the order in the ReturnStack) is not fixed. The sequence is sketched in the following figure.
See also