|
Hi,
> setfenv(1, setmetatable(env, {_index = function_that_finds_env()})) This seems to be very difficult to implement, isn't it? If I understand it correctly, this problem seems to be similar to the one that we faced with VEnv in Lua 5.0. We could redefine module() to use with Lua modules, but we couldn't redefine the behavior used by C modules so we have an environment that doesn't work with required binary libraries.Your problem seems worse than mine.
Notice that most module writers will have collected any used globals into locals. So you can't really change references after you require() the modules. :/ Regards, Diego.