lua-users home
lua-l archive

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


Sorry, ignore all that, turns out my code was working with an older version of Lua. That's a real shame, having some sort of portable support for C-function coroutines would be useful :(

Mark Feldman wrote:
Roberto Ierusalimschy wrote:
It is forbidden to resume a C function. The manual should mention that.
Thanks for the report.

Is this by deliberate design? Or by virtue of the fact that it hasn't been deliberately implemented? As far as I can gather the lua_resume function works by re-using the function pointer on the top of the stack from the previous call, so it's possible (in 5.1.4 at least) to yield C functions so long as you ensure that this value is maintained. You also have to handle the resume logic yourself since there's only one entry point:


This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.