[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 10:50:16 +0200
> 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'
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