lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.

-Rob

On Fri, May 11, 2012 at 10:27:48AM +0200, Thijs Schreijer wrote:
> > Do you have multiple lua_States created by lua_newstate, or just
> > separate coroutines created by lua_newthread?
> 
> Sorry, should have mentioned that; 1 state with multiple coroutines. I'm
> aware that I cannot execute a function from one state in another.
> 
> > -Rob
> > 
> > On Fri, May 11, 2012 at 09:54:13AM +0200, Thijs Schreijer wrote:
> > > A lot has been written on callbacks, but couldn't find an answer to
> > this one
> > > in the archives;
> > >
> > > Does it make a difference on what (valid) lua_State object I execute
> > a
> > > callback? Does it change anything for the callback function being
> > executed?
> > > Or is there no difference, whatever lua_State is being used (as long
> > as it
> > > is valid)?
> > >
> > > Any pointers are appreciated.
> > >
> > > Thijs
> > >
> 
> 
>