Is there an equivalent for Runtime:dispatchEvent(…)?
I would like to dispatch a runtime event from my plugin.
I see a dispatchEvent in these docs, but it’s not very descriptive.
http://docs.coronalabs.com/native/android/html/com/ansca/corona/CoronaLua.html
Thanks.
So it looks like CoronaLuaDispatchEvent has been implemented in the Enterprise Android API, but not CoronaLuaRuntimeDispatchEvent. Will this be available at some point?
So it looks like CoronaLuaDispatchEvent has been implemented in the Enterprise Android API, but not CoronaLuaRuntimeDispatchEvent. Will this be available at some point?
Darune
July 30, 2013, 2:18pm
4
I really need to send Runtime event from java as well it exists on iOS :
http://docs.coronalabs.com/native/ios/index.html#sending-events-to-runtime
But not on Android, anyone with a workaround ?
Darune
July 30, 2013, 4:36pm
5
i ended up doing the following helper function
public static void sendRuntimeEvent(LuaState luaState, String eventName, Map\<String, String\> parameters) { luaState.getGlobal("Runtime"); luaState.getField(-1,"dispatchEvent"); luaState.pushValue(-2); luaState.newTable(); int idx = luaState.getTop(); luaState.pushString(eventName); luaState.setField(idx,"name"); if (parameters != null) { for (Map.Entry\<String, String\> entry : parameters.entrySet()) { luaState.pushString(entry.getValue()); luaState.setField(idx, entry.getKey()); } } luaState.call(2, 0); return; }
Cool. Will give that a try.
Darune
July 30, 2013, 2:18pm
7
I really need to send Runtime event from java as well it exists on iOS :
http://docs.coronalabs.com/native/ios/index.html#sending-events-to-runtime
But not on Android, anyone with a workaround ?
Darune
July 30, 2013, 4:36pm
8
i ended up doing the following helper function
public static void sendRuntimeEvent(LuaState luaState, String eventName, Map\<String, String\> parameters) { luaState.getGlobal("Runtime"); luaState.getField(-1,"dispatchEvent"); luaState.pushValue(-2); luaState.newTable(); int idx = luaState.getTop(); luaState.pushString(eventName); luaState.setField(idx,"name"); if (parameters != null) { for (Map.Entry\<String, String\> entry : parameters.entrySet()) { luaState.pushString(entry.getValue()); luaState.setField(idx, entry.getKey()); } } luaState.call(2, 0); return; }
Cool. Will give that a try.
This was a great help for me too, thanks!
This was a great help for me too, thanks!