it turns out that using the co-routine system directly in lua, causes each co-routine to be pushed onto the main stack, however even when a thread dies it doesn't pop it off the stack. this eventually results in a stack overflow, which is baaaad =)
it took me a while to come to terms with the fact that lua was not at fault, it just seems that in this case, if you make it, it's yours. given that each co-routine can potentially spawn off more, it means that i need to search and prune the stack when a thread dies, not too hard and no performance hit, it just took a long time for me to come to grips with the fact lua wasn't gonna do it for me =/
so my next immediate task(s) are to implement the audio system fully, this should be fun =D
the S3Engine audio system uses concepts developed in the Flare3 engine to make sound management a breeze, the most important of which is 'dot notation addressing'
this means that every sound is made reference to via a user-defined dot notation string, each level of the notation specifies a new 'pool' of sounds, for instance:
in here we see that our root is 'game' and the next pool is 'effects' and then we jump straight to the sound alias, using this address or slight variations give us lots of power such as:
this will stop only "gunshot0"
this will stop all of the sounds in the "effects" pool
this will stop all of the sounds in the game root
with this addressing system at the core of the audio system it makes using it very simple.