lua-users home
lua-l archive

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



Hi list,
       
In general, 'require' a module in will affect all coroutine. Thus if I change 'moduleA.b' value in one coroutine, another coroutine will find 'moduleA.b' has been changed.
So I want to know the possiblity to use 'require' to load module in different coroutines have independent environment, in this case, changing 'moduleA.b' value in one coroutine do not affect another coroutine (like libc 'errno').
I try to use 'setfenv', but it only for global variable, not for 'require' and 'module'.

If the method descibed above is impossible, does it possible to create an interpreter with a table as its initial environment by pure lua code, like Python's code.InteractiveInterpreter?


thanks.





ps. I use 5.1.4.
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail is solely property of the sender's organization. This mail communication is confidential. Recipients named above are obligated to maintain secrecy and are not permitted to disclose the contents of this communication to others.
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the originator of the message. Any views expressed in this message are those of the individual sender.
This message has been scanned for viruses and Spam by ZTE Anti-Spam system.