[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- 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: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org]
> 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
> was
> 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
> in
> > > the global Lua environment, you may notice some...interesting
> behavior
> > > if you aren't consistent with with lua_State you use. Coroutines
> may
> > > have a different global environment from one another, so one
> > > coroutine's "print" function may be different from another, or it
> may
> > > not even exist in a given coroutine. That is, of course, if you
> (or
> > > someone else) modifies your coroutines' environments.
> >
> > The coroutine is initiated from a function, which has that
> 'different'
> > 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
> callback
> > function then also bring along its own environment? the one that was
> set
> > when it was defined?
> > Or is the environment of the callback function altered to the one of
> the
> > coroutine?
> >
> >
> >
> >