Your message is basically asking somebody on this list to debug/profile that complicated beast composed of C++ and Lua.
Sorry, that is not my intention. I'm working on reducing my test case, but at this point I am just looking for ideas, not direct debugging help.
There might still be volunteers, but I'd say you should isolate this problem to something comprehensible to people familiar with C/C++ and Lua, but not necessarily with your project.