lua-users home
lua-l archive

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

> When you clone a namespace, the implementation still refers to the
> original namespace. If you make changes to the cloned namespace (such as
> changing a constant, or providing a new implementation for one of its
> functions), the library's implementation will not see the changes.
> Anyone has an obvious solution for this problem?
	I don't think this is a problem...
	We have a similar situation in CGILua 5.0 with some launchers
that persist with the server process (Apache module or FastCGI).  These
launchers have to run one script per request in the same Lua state.
Therefore we have to protect the global environment from one execution
to another.  The solution was to create a Virtual Environment which
inherits the globals from the original but kept any change inside it.
After the script execution, it is thrown away.
	There is no "cloning", but inheritance.  The changes you pointed
out will be restricted to the environment where they were made.