> a, b = foo() > setfenv(a, {x=2}) > b() > > Does that print 1 or 2? Neither: it gives an error: attempt to call global 'b' (a nil value). If you make a,b local, then it does print 2.