背景 前面的文章演示了使用闭包函数实现 状态的迭代器. 本文演示使用 coroutine来产生迭代器的例子. coroutine迭代器例子 -- 遍历二叉树 local binary_tree = { data = , left = { data = , left = { data = }, right = { data = } }, right = { data = , left = { data = , left = { data = 5.5 }, right = { data = 7.4}…
Joynet 项目地址:https://github.com/IronsDu/Joynet 介绍 high performance network library for lua, based on https://github.com/IronsDu/accumulation-dev and lua coroutine. Joynet 的网络底层使用多线程,但Lua (层面)是运行在单线程上. 借助协程提供同步形式的API.(同步的socket api,同步的http api,同步的redis…