I'm writing an application which enables users scripts to be executed, multiple in parallel. So each script has its own lua_State. Now i want to provide those scripts a function they can call to be continued later, for example wait(60) to wait 60 seconds and then be resumed. My idea was to just yield those scripts from C and resume them after 60 seconds. That way they won't need to wait in a locking way in its own OS thread.
Though what happens when I try to execute my wait C function from Lua which is build like,
, is that i get the following error:
attempt to yield across metamethod/C-call boundary
[C]: in function 'wait'
I thought with the coro patch from luajit.org
something like this is possible. So my question is: How to yield/resume the right way from C?