lua-users home
lua-l archive

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


Edgar Toernig wrote:
> How do you create the new threads?  With lua_newthread?  Unless it's first
> argument is NULL the new thread will share state (globals, objects, tag
> methods, ...) with the lua_State you passed as the first argument.  Only
> when you call lua_newthread will NULL you get an independent thread.

share state? they use the same global state? i just thought that the new
thread had a copy of the original thread. The doc says:

"Each thread has an independent table for global variables. When you create
a thread this table is the same as of the given state, but you can change
each one independently."
Doesn't that mean that at the beginning the global tables are equal (but not
the same) and that i can add a key to one table without seen it in the
other? And if i modify a value that is in both tables the value will change
in both tables?


Ignacio Castaño
castano@asidesoft.com



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com