From Corona, you build up a Lua table named event and dispatch it:
local event = { name="coronaView", message="Hello from CoronaCards!" } --dispatch the event to the global Runtime object local result = Runtime:dispatchEvent( event )
The event.name value most be “coronaView”. But after that, you can put in any valid Lua data type in the table. It could be:
local event = {} event.name = "coronaView" event.playerId = 10 event.isTrue = true
any way you want to create a key-value pair table.
On the native side, you’re receiving a NSdictionary which is the ObjC version of a key-value pair table.
- (id)coronaView:(CoronaView \*)view receiveEvent:(NSDictionary \*)event { NSLog( @"Logging properties of the event: %@", event ); self.myLabel.text = [event objectForKey:@"message"]; int playerId = [event objectForKey:@"playerId"]; BOOL isTrue = [event objectForKey:@"isTrue"]; return @"Nice to meet you CoronaCards!"; }
Or something similar to that.