There are oh so many libraries for that:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;baruch&#x2F;libwire&#x2F;wiki&#x2F;Other-coroutine-libraries" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;baruch&#x2F;libwire&#x2F;wiki&#x2F;Other-coroutine-libra...</a><p>And if you don&#x27;t like any of those, my next choice would be to use the implementation from Luajit 1.x and 2.x, called Coco but not packaged into a separate library:<p><a href="http:&#x2F;&#x2F;coco.luajit.org&#x2F;portability.html" rel="nofollow">http:&#x2F;&#x2F;coco.luajit.org&#x2F;portability.html</a>