Re: Derived member functions as coroutines
Matt Spong <[email protected]> Fri, 24 Jun 2011 09:14:18 -0400
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <-4316743995664416733@unknownmsgid> |
Yes, that turned out to be my problem. The right way to do get the function object seems to be: luabind::object func = luabind::globals(thread)[className]["foo"]; One thing I haven't figured out - how to determine className from C++? Currently I'm passing it from Lua. Matt On Jun 24, 2011, at 5:53 AM, Nigel Atkinson <[email protected]> wrote: > 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 > _______________________________________________ > luabind-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/luabind-user ------------------------------------------------------------------------------ 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