lua-users home
lua-l archive

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


On Fri, 2006-08-11 at 16:51 +1000, D Burgess wrote:
> How about an __index metatable entry that is a function that
> checks to see if what it is loading is a function and sets the
> environment of each function that it gets from the  master
> environment?
> 

Wow! So simple, so obvious. And I'm so thankful!

In the base thread:

t = {}

t.__index = function(table, key)
	return rawget(getfenv(0), key)\n"
end

setmetatable(getfenv(0), t)

At least, this seems to work so far. <crosses fingers>

-- 
William Ahern <wahern@barracudanetworks.com>


--------------------------------------------------
This message was scanned for Spam, Spyware and Viruses
For more information, please visit:
http://www.barracudanetworks.com