[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Thread question
- From: "D Burgess" <dburgess@...>
- Date: Tue, 18 Jul 2006 11:03:14 +1000
Thanks Wim, I have (re)read the list messages and Wiki on this subject.
Having created my thread specific global table and __index metatabled it
to the mainthread global table, is the best way to handle the base functions
next(), pairs() etc to simply reexecute base_open() (lbaselib.c) on the new
thread object or is it better to "copy" the baselib functions from the main
lua state to the new lua thread?
Wim Couwenberg wrote:
> If I have code like
> lua_State* L= lua_create()
> lua_State* L1 = lua_newthread(L1);
> lua_replace(L1, LUA_GLOBALSINDEX);
> Does this replace LUA_GLOBALSINDEX in the main thread(L) as well?
No. Threads have their own globals, but share the registry.