[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua registry, environment, and threads.
- From: Mark Hamburg <mark@...>
- Date: Sat, 9 Jan 2010 00:32:33 -0800
I'm not awake enough tonight to write it, but I realized that one could write a function pushscope( env ) which, provided it knew the current environment (that's part of the trick to writing it), could construct a new environment tacking the argument onto the top of the stack. That would allow one to write:
in pushscope( env ) do
-- the entries in env are now visible as part of the globals and env is now the target for global assignments
end
This does not get one dynamic scoping since it isn't visible inside of anything called within the construct, but it does essentially handle the table scope case (http://lua-users.org/wiki/TableScope).
For that matter, pushscope could take a series of scopes to add on.
Mark
- References:
- Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Mark Hamburg
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Enrico Colombini
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Edgar Toernig
- Re: Lua registry, environment, and threads., Mark Hamburg