MineHacker API Docs/SandboxContext class
All mods have a SandboxContext for their global scope. Despite the name, mods are not sandboxed, and all (non-sandboxed) Context objects inherit SandboxContext as their base class. However if you need a sandbox, you can construct a SandboxContext using the new keyword which does indeed create a sandboxed object which you can eval untrusted code on.
Properties
Context - The Context class. When created on a SandboxContext that is a sandbox, the resulting context will also be a sandbox, without any of the properties or methods from the Context class.
SandboxContext - The SandboxContext class.
Methods
eval(script, [name]) - Evals code on the context. The optional name parameter is used to identify error messages.
compile(script, [name]) - Returns an object with a run(scope) method that can be used to run the script. The run method takes a required scope parameter that is a context to run the code on. There is also a filename property that stores the name you specified, or "eval" if you omit the parameter, useful to identify which script is which.
Comments