Lyn Headley wrote: > I have been looking into Coco but I can't figure out if it is > compatible with Luajit 2.0. Coco was used for LuaJIT 1.x. But switching C stacks caused too many problems. That's why LuaJIT 2.0 doesn't use it anymore (it's able to yield across builtins, but not across arbitrary C calls). > Are there any strategies people recommend for doing this, or > must I restructure my program? You're probably using LuaJIT for its performance benefits. But callbacks from C into the VM are slow -- really slow compared to everything else. If possible, rewrite the intervening C code in Lua (maybe with the help of the FFI) and/or switch to a pull-style API (iterator instead of callbacks). --Mike