Coroutine in Lua

Source: Internet
Author: User

Today try to use Coroutine in the lua5.1 of the project, think "elegant" to solve the problem of pop-up dialog box, let it have the return value.

But encountered lua:attempt to yield across Metamethod/c-call boundary. check on the Internet, did not fix, will not get. (The consequence of not being enthusiastic about work is this, if I love it, I will replace the whole project with Lua 5.2,5.3)

Here are a few articles for future backup. And a little summary of your own:

Http://blog.codingnow.com/2012/06/continuation_in_lua_52.html

Http://lua-users.org/lists/lua-l/2008-05/msg00181.html

Http://stackoverflow.com/questions/8459459/lua-coroutine-error-tempt-to-yield-across-metamethod-c-call-boundary

Http://www.cppblog.com/kevinlynx/archive/2008/08/12/58636.html

1, some people have made it clear that the main line thread yield will make this mistake. The explanations given in the cloud-wind blog seem to be more essential.

2,cppblog's article, obviously wrote a (it is to solve the dialog box problem), but its code I almost copy, embedded in the project, or not. It also uses 5.1.

Coroutine in Lua

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.