lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Javier Guerra wrote:
> steventidwell@yahoo.com wrote:
> > Hi. This is my first post to the mailing list and I have a few questions. I have used some Lua before in WoW modding and am now working on a game in c++. What I would like to know is if anyone has any good explanations of how to set up event triggers using Lua. For example setting timers and checking for events sent to a c++ app from a Lua object. Any help would be greatly appreciated. Thanks!
> 
> these are WoW-specific issues, not really Lua language related.

...and of course, as soon as i hit 'send', i realize you're not asking about WoW; but you're developing your own game.

welcome, then! this is some of the things we do like to discuss here :-)

in general, you have to design some API to expose the functionality of your core to Lua.  there are several styles for this, and you can create your own.

specifically, for events and timers, two main ways are: 

1) installing callbacks

2) using coroutines

this can be a long and interesting discussion.  also check the list archives, you might get some ideas already discussed and criticized.

-- 
Javier