bennyxqg / lua-alchemy

Automatically exported from code.google.com/p/lua-alchemy
0 stars 0 forks source link

Workaround for flyield #121

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Employ "controller coroutine" idiom in loadfile/dofile (as opt-in 
functionality), and yield back to the controlling AS3 code, so callbacks 
would be called back to Lua.

Use this:

http://github.com/lua-nucleo/lua-nucleo/blob/master/lua-
nucleo/coro.lua

See usage example in tests: 

http://github.com/lua-nucleo/lua-nucleo/blob/master/test/coro.lua

If opt-in is enabled:

Enable as3.filegetcontents() in loadfile()

Replace all as3.flyield()s in as3.filegetcontents() with coro.yield_outer().

Replace coroutine.resume() with coro.resume_inner()

Original issue reported on code.google.com by aglad...@gmail.com on 30 Aug 2009 at 8:20

GoogleCodeExporter commented 9 years ago

Original comment by aglad...@gmail.com on 30 Aug 2009 at 8:21

GoogleCodeExporter commented 9 years ago
Note that coro.lua is already available in ag/lua-test-system branch

Original comment by aglad...@gmail.com on 10 Sep 2009 at 11:28

GoogleCodeExporter commented 9 years ago

Original comment by aglad...@gmail.com on 11 May 2010 at 9:58

GoogleCodeExporter commented 9 years ago
No, coro.lua is no longer available. But we will have to bring it back.

Original comment by aglad...@gmail.com on 18 Apr 2011 at 8:33

GoogleCodeExporter commented 9 years ago
Note that pcall also need to be replaced.

Original comment by aglad...@gmail.com on 18 Apr 2011 at 8:37

GoogleCodeExporter commented 9 years ago
New link for the cases is here: 
https://github.com/lua-nucleo/lua-nucleo/blob/master/test/cases/0050-coro.lua

Original comment by aglad...@gmail.com on 18 Apr 2011 at 8:55

GoogleCodeExporter commented 9 years ago
See a rough example here: https://gist.github.com/926163

Original comment by aglad...@gmail.com on 18 Apr 2011 at 9:00