摘要:
读《Programming In Lua》协程那一章,比较困惑的还是procuer-consumer那个例子:function consumer(prod) while true do local x = receive(prod) print(x) endendfunction receive(prod) local status, value = coroutine.resume(prod) return valueendfunction send(x) coroutine.yield(x) -- go back to where ... 阅读全文