5
votes

A required chunk runs in global environment by default.

Each loaded user script is setup to run in a sandbox and if the script happens to contain a require call, it will modify the global environment.

Is there a way to set that environment to the same one of the calling script?

1

1 Answers

3
votes

Yes, you can replace require with your own function.

The prosody XMPP server does this here.