Lua coroutine extension

Hi, all

I have add coroutine support in Lua, and provide two extension functions for Lua coroutine.
coroutine.start(func) – create new coroutine and resume it. the function code:

function coroutine.start(func)
    local co = coroutine.create(func)
    return coroutine.resume(co)
end

coroutine.sleep(time) – sleep current coroutine, it will wake up until the time arrived.

I think it is helpful. For more information, please refer the Coroutine.lua sample in LuaScripts.

1 Like

??

Is it possible to make the coroutine yield/resume based on other events and not just based on time step?

???

with this, debugger support, and code completion is becoming more tempting to give up my static typing. except i have about half of the api i use commonly in my fingers now. on my resource editor branch i have a hacky version of a coroutine built into the update loop. getting the real deal would be much better.

angelcode.com/angelscript/sd … orout.html

Two functions will be added:

coroutine.waitevent( event )
coroutine.sendevent( event )

weitjong ???

Yes, I think so. With this, the coroutine will be more versatile.

coroutine.waitevent( event )
coroutine.sendevent( event )

added, please get it.

1 Like

For a second, I thought I read "add please, (in order to) get it. :laughing:
Thanks Aster. You are the best.