lua-users home
lua-l archive

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


> well, thanks much, I understand the concept, but I don't know how to do 
> it, could you please explain with some code snippets?

Start with this. --lhf

local g={}	-- populate as desired
local G=getfenv()
setmetatable(g,{__index=G})
setfenv(1,g)

print"hello"	-- uses print from G
print=23
G.print"hello"	-- original print intact
print"hello"	-- this raises an error