Is it safe to create several (hundreds?) of threads and yield/resume
each of them independantly?
Not sure what you mean by 'independently'. From a single OS thread, you
can create a few hundreds and then yield/resume one at a time. To create
more, AFAIK you have to recompile the library after increasing
LUAI_MAXCSTACK.
To have several threads running concurrently (from different OS threads,
perhaps), I think you have to redefine 'lua_lock' and related defines.
There is a chapter in 'Programming in Lua' about non-preemptive
multithreading that may be useful to read.