Closed muisje closed 4 years ago
I solved this with having context object as argument and setting member values inside the function called and reading it after the the event is fired with a getter for the set property.
I do think using out would have been a nicer solution though.
Glad that you found a solution.
I consider exposing the state the state-machine is in an anti-pattern. The reasoning is, that while the state-machine is executing a non-empty queue of events - especially an active state-machine - it is hard to say in which state the machine really is.
I normally advise using some flags on the containing class that reflect the states that you want to expose to the environment of the state-machine.
Hey,
I was implementing a function that executes an event in which i want to have a variable set for the caller to read. I need this because i need to know which state i'm in outside of the state machine.
So if i could fire an event with a return value or with a ref/ out parameter that would be nice :)