[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: in-do-end
- From: steve donovan <steve.j.donovan@...>
- Date: Sat, 16 Jan 2010 18:52:46 +0200
On Sat, Jan 16, 2010 at 5:48 PM, Eike Decker <zet23t@googlemail.com> wrote:
> formerly, this was much more complicated (assigning to a (short) local
> variable and then writing something like v.x,v.y,v.z = 1,2,3
Yes, it is a lot easier than the equivalent Lua 5.1 setup ;)
t = {}
setfenv(function()
x = 1
y = 2
g = function() return x+y end
z = 2
end,t)()
assert(t.x == 1 and t.y == 2)
assert(t.g() == 3)
This doesn't however modify the envronment of loadstring, however.
steve d.