Re: Derived member functions as coroutines
Nigel Atkinson <[email protected]> Fri, 24 Jun 2011 19:49:09 +1000
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 2011-06-23 at 12:39 -0400, Matt Spong wrote: > I have an abstract base class which I am deriving from in Lua and > overriding virtual functions, using wrap_base as described in the > documentation. > > Where I run into problems is calling the derived members as coroutines: > > luabind::object self; // this gets passed to wrapper's constructor by > derived class's __init > > luabind::object func = self["foo"]; > luabind::resume_function<void>(func, self); > > This all appears to work properly until the coroutine calls yield(). > When this happens, lua_status() returns 0 rather than LUA_YIELD, so my > scheduler decides the coroutine has exited and drops it. > > Is this a bug in luabind or am I doing something incorrectly? > > Matt I haven't used luabind::resume_function myself, however looking at the docs, it looks like you have to assign your "func" luabind::object using the thread you made with luaL_newthread. Hope that helps. Nigel ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense.. http://p.sf.net/sfu/splunk-d2d-c1