Re: Can I create a custom event?
Posted: Sat Apr 18, 2020 3:21 pm
I see. But the manually raising event inside function introduces a new issue to be resolved.
Invoking raiseEvent() in my case is equal to invoking send() directly (raiseEvent->wait_event->send)
Then, the function should look like:
We expect the regular flow should be
Invoking raiseEvent() in my case is equal to invoking send() directly (raiseEvent->wait_event->send)
Then, the function should look like:
Code: Select all
function wait_line(pattern, action)
thread = coroutin.running()
tempTrigger(pattern, [[wait_resume()]], 1)
send(action)
return coroutin.yield()
end
While for some unexpected reason(network, server/client cpu and etc.), there may be chance the flow becomestrigger create -> send action -> coroutin.yield -> pattern coming(get response for send) -> trigger fired -> resume
If the second case occur, the wait_line will trap in waiting forever.trigger create -> send action -> pattern coming(mud server response as fast as possible) -> trigger fired -> resume(nothing occurr as yield has not come) -> coroutin.yield