lua-users home
lua-l archive

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


>The Manual says regarding lua_newthread:
>
>"The new thread returned by this function shares with
>the original state all global enviroment [...] but has an
>independent runtime-stack."
>
>I understand this as if changes to the globals, for instance
>via lua_setglobal or lua_register, will be visible to all other
>threads.

Yes.

>But the manual again:
>
>"Each thread has an independent table for globals"

The manual goes on to say:

 When you create a thread, this table is the same as that of the given state,
 but you can change each one independently.

So, as long as you don't change the table of globals, it remains the same
as the one in its "sister" state.
--lhf