I have a callback function inside a module. I want to expose data available in the callback via the event object to main.lua and the rest of the application.
When I do this, I seem to get partial information, not everything and the callback function doesn’t seem to complete properly.
For example
functiona(callbackfunction)
callbackfunction(e)
if e.state = “yes”
dispatchEvent({name=“yes”, value1=e.value1, value2=e.value2})
elseif e.state = “no”
dispatchEvent({name=“no”, value1=e.value1, value2=e.value2})
end
finishFunction()
end
finishFunction() should run on any case, after the event is thrown. What I am seeing is finishFunction() never executes. I’m also getting value1 & 2 when catching the event, but missing a few values. If I print them inside the callback function, all values print properly and exist. If pass them (3-6 of them) via the custom event, I only seem to get the first two when catching it.
My questions are:
- Is there any reason dispatching and event would cease executing the rest of the callback function?
- Is there a better way to pass data from the event object inside a callback to main.lua and the rest of the application. This callback is inside a module file, and I want to expose this information to the rest of the application, ideally through an event that can be listened for unless there is a better way.
- Why does e.value3, e.value4, etc print() perfectly fine in the callback, but when passed via the event only some of them are available. [import]uid: 160288 topic_id: 34918 reply_id: 334918[/import]