Listening to local events

Hey Guys,

I'm wanting to register listeners to listen to local events I create during the course of my game. The event list is nothing more than an ipairs table and the listeners table just a table of string/function pairs. I can do all this easy enough, but what I'm puzzling over is how to add events to the table when events occur during gameplay.

I can pass the eventList table through to each sub system update, and then simply use table.insert(eventList, {eventdetails...}), but when tap events occur, I'm not sure on the best method of inserting to the eventList as the objects will not have the eventList in scope.

Maybe I'm going about this in the wrong approach, but simply I want to be able to create my own local events and register my own listeners for them. If you need me to explain more, let me know :)

Cheers,

Andrew.

views:1311 update:2012/1/4 9:12:54
corona forums © 2003-2011