This is yet another question about lua threads. I’ve been looking though the archives but haven’t been able to find exactly what I’m looking for.
What I have is a main lua script that I create new states from using lua_newstate, one for each object that has a script. I have registered a wait() function so that the thread can be yielded and resumed. The wait() function is a C function that calls lua_yield() before returning.
The yield and resume all works fine.
What I don’t quite understand is how to call other functions inside a script that has been yielded. Example:
-- lua script
while 1==1 do
So after calling onActivate I want to be able to call the function onHit.
I call my functions from C something like this:
Sorry if this has been covered already. Any pointers to how to setup Lua to work like this would be much appreciated.