lua-users home
lua-l archive

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


On Thu, 2006-08-10 at 23:12 -0700, William Ahern wrote:
> > Huh. This _seems_ to work:
> > 
> > 	function func_called_from_each_thread()
> > 		setfenv(1, getfenv(0))
> > 
> > 		...
> > 	end
> > 
> 
> Ack. This literally only localizes the function. Any function called
> from within still doesn't see the thread's globals.

I guess this settles it:

---
[Lua 5.1 Referance Manual - Section 2.9]

Environments associated with threads are called global environments.
They are used as the default environment for their threads and
non-nested functions created by the thread (through loadfile, loadstring
or load) and can be directly accessed by C code
---

What I want isn't possible, other than the hard way: 1) loading all the
code into each thread separately; or 2) updating the environment of
every object in the new thread; or 3) importing objects manually and/or
explicitly inheriting the environment from within every function that
wants it.

-- 
William Ahern <wahern@barracudanetworks.com>


--------------------------------------------------
This message was scanned for Spam, Spyware and Viruses
For more information, please visit:
http://www.barracudanetworks.com