lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Wow! A first contribution!

>> > Excellent, thank you. I just did a quick test to see if coroutines work -
>> > they do - do you know if it would be possible to yield across
>> > ActionScript "frames", or does the whole script need to be executed
>> > within a single one currently?

>> No plans to yield across ActionScript "frames" so far. Suggestions on
>> the form and on the implementation are welcome.

> I ported the LuaCoco 1.1.5 patch to Alchemy.  This allows yielding across C
> calls (metamethods/pcall/iterators/callbacks)

Great! Thank you!

> and might allow yielding across
> ActionScript "frames" (I am not sure what you mean by ActionScript "frames").

Actually I'm not sure either, that was Duncan's wording. :-)

> The patch is attached to this issue on the LuaAlchemy project site:
> http://code.google.com/p/lua-alchemy/issues/detail?id=53

> I had first tried to hack the jmp_buf used by the _setjmp/_longjmp
> implementations that Alchemy provides, but they don't have a return address
> on the fake C-stack.  Instead Alchemy has what they call Machines(these are
> just a class for each C-function).  The Machine instances are chained
> together to create the callstack.  The fake C-stack is only used for passing
> parameters.  Each Machine has a "state" member that is used to resume that
> function after a called function has return or when _longjmp is call to jump
> back to that spot.

> I ended up merging the _setjmp/_longjmp ActionScript code(pulled from the code
> generated by Alchemy, I don't know what license that code falls under) into a
> single context switching function.

Great work, Robert! Thank you again!

However, there are couple of issues:

1. Our goal at Lua Alchemy to keep Lua sources pristine -- at least by
default. So we'd need some scheme to keep the patch optional.

2. Anyway, we can not merge the patch until licensing issues are cleared.

Meanwhile, I'll put a link to the patch somewhere to the docs.

Alexander.