[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: on what *L to execute a callback from c
- From: Rob Hoelz <rob@...>
- Date: Fri, 11 May 2012 05:01:57 -0400
Good point; I believe that the coroutine will use the environment it was
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