Hi,
I've been considering coding most stuff in LUA directly lately. I can now register new CFuncs into the lua engine, run chunks (and with that, files) but the problem of yielding comes out, since all code must run in the main thread for obvious reasons.
A first design could be to invoke some LUA pulse function in the injected pulse function which in turns calls coroutine.resume in some function. That function would in turn call yield whenever it has to wait for some event. I would like to bring up a couple of questions:
- Has anyone implemented a similar model with success? Or could it be improved in some obvious way?
- In 1.12, the coroutine part of the lua library seems to be missing. 1.12 uses Lua 5.0 which I can see includes the coroutine library from the documentation. However, Wow's implementation seems to remove it. I can locate the varios LUA library loading functions, but not the coroutine library, neither the corresponding functions. Can anybody confirm if the library is really there, hidden somewhere, or has been striped?
- Has anyone managed to inject/load a DLL with a regular LUA implementation so that the LUA system can be used more easily (and comprehensively, in case of stripped libraries)? I tried to use Lua 5.0.3 in 1.12 but it kept crashing when passing it WoW's lua_state pointer, probably due to some binary incompatibility. (This despite running in the main thread, of course)