[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: a new proposal for environments
- From: Doug Currie <doug.currie@...>
- Date: Thu, 25 Feb 2010 22:52:26 -0500
On Feb 25, 2010, at 8:30 PM, Roberto Ierusalimschy wrote:
> [...] what you want is
> that all functions being created in a library share a common upvalue
> (which happens to be a table). This is exactly the support you get from
> luaI_openlib. (Except for functions being created dynamically, which
> is not that common and can be done it manually.)
Yes. I have advocated, e.g., in Lua Gems, using LUA_ENVIRONINDEX for thread local storage in libraries. There's no reason a shared upvalue couldn't be used to do the same thing, and luaI_openlib would be a handy way to do it.
-- e