lua-users home
lua-l archive

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


This is the last one: combining an hypothetical getfenv with my short
lambda suggestion, we get

function table.in(tabl, func)
	setfenv(func,tabl)
	func( getfenv(2) )
	return tabl
end


foo=3

local t = table.in( {}, (env):
	bar = env.foo   -- bar now == 3
	baz = 5
::)

Most importantly, this doesn't add any new semantics to the language.