lua-users home
lua-l archive

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


Scott wrote:
> I'd like to have my game ai (it's a shoot em up) running as scripts.  
> I've figured what I want to do is use coroutines.  I've looked them
and 
> got a handle on how they work from the lua script side but how does
that 
> tie up with the C side?  What's the best way of calling scripts?  
> wouldn't dofile be a bad idea in game?  if not dostring?

There is an example of coroutines in Doris. See http://doris.sf.net/

You'll need to get the coroutine example from CVS:

	http://cvs.sourceforge.net/viewcvs.py/doris/doris/bin/eg/

Look at the gravity.lua example. It's lots of objects under the 
influence of each others mass.

Doris is bound to OpenGL so this is an example of how you run a main 
loop using GLUT, with Lua listening to update callbacks and then calling

GL. You could write your game using GL and Doris using a similar set up 
to the one here.

I'm, very slowly admittedly, adding SDL and network support to Doris so 
it should have sound, joystick and net support in the future.

Nick