lua-users home
lua-l archive

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

Thanks for the information!

So... threads share the global environment with the parent lua_state. 
Therefore, if I change a global variable in my thread, it WILL also
change in the parent lua_state.

How can I prevent this and give my thread it's own global environment?

The idea is so that each lua_state thread can have it's own individual
global variable called "Connection" or whatever and each thread won't
be overwritting each others data.

On 12/21/05, Rici Lake <> wrote:
> On 21-Dec-05, at 8:46 PM, John Klimek wrote:
> > Rici:  Thanks for the link!  It seems to talk a lot about "closures"
> > but I'm not sure what they are.  I've searched the Wiki and have seen
> > some information but it was still a bit confusing... Can you explain
> > this a little more to me?
> Programming in Lua devotes a chapter to the subject:
> <>. But the short answer is that a
> "closure" is the first-class Lua object which you probably think of as
> a function.