lua-users home
lua-l archive

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

The Lua/SDL_mixer integration is having the following problem:

   Lua runs happily, starts to play a tune  ..dam-dam..
   Attaches a callback to get to the rhytm

   Lua continues running..
	--> sdl_mixer gives a C callback -> sdl_mixer module -> Lua call

Now, the callback probably happens in another thread, or otherwise
asynchronously to the main loop, running the Lua stack.  How do we deal
with this?

A start to a solution could be organising the way "Lua continues running".

If you're able to switch your current approach to one that runs in brief steps, you're (probably) pretty much nearly there. It certainly makes the (important!) synchronising bit that David mentions fairly trivial.

Then again, I haven't looked at your sdl_mixer code. So I'm not sure how feasible switching is in your situation...

no signature is a signature.