Original Post
Greetings. I'm working on creating a game engine in C++, with the specific game logic entirely data-driven in Lua. I want to be able to create new types of events in my Lua scripts for my C++ event manager to handle. I figure I could create a Lua table of strings to be hashed as event types easily enough, but what would be the best way to specify event data / function parameters? When the C++ event manager receives an event, it will call the appropriate Lua function for any objects subscribed to that event. I want to be able to fire events in a Lua script, however, and I'm not sure how to handle passing event data to the C++ event manager. So basically I don't want any of my event types hard-coded. When something subscribes to an event in a Lua script, it should create a new event type if it doesn't already exist. Check. The problem is I want to be able to fire an event just as easily by using a string as the event type. I've been trying to think of the best way to pass data along with the event back and forth between C++/Lua but everything I've thought of so far (building a table to pass into the FireEvent function call, etc...) seems unnecessarily complicated. Any ideas? [Edited by - Cactuar on August 31, 2006 7:01:34 PM]