[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: on what *L to execute a callback from c
- From: "Thijs Schreijer" <thijs@...>
- Date: Fri, 11 May 2012 21:24:40 +0200
Final verdict then; there is no difference, any *L will do, as long as it is
valid and originates from the same global lua state
> -----Original Message-----
> From: firstname.lastname@example.org [mailto:email@example.com]
> On Behalf Of Rob Hoelz
> Sent: vrijdag 11 mei 2012 11:02
> To: Lua mailing list
> Subject: Re: on what *L to execute a callback from c
> Good point; I believe that the coroutine will use the environment it
> compiled with.
> On Fri, May 11, 2012 at 10:50:16AM +0200, Thijs Schreijer wrote:
> > > Well, if you're using multiple coroutines and are relying on values
> > > the global Lua environment, you may notice some...interesting
> > > if you aren't consistent with with lua_State you use. Coroutines
> > > have a different global environment from one another, so one
> > > coroutine's "print" function may be different from another, or it
> > > not even exist in a given coroutine. That is, of course, if you
> > > someone else) modifies your coroutines' environments.
> > The coroutine is initiated from a function, which has that
> > environment. Right?
> > Now if I store a function (passed as a parameter to a c function) on
> the c
> > side and later collect that function (say I stored it in the
> registry), and
> > execute it on a different *L than the one I got it from, doesn't my
> > function then also bring along its own environment? the one that was
> > when it was defined?
> > Or is the environment of the callback function altered to the one of
> > coroutine?