Provides helper functions for incorporating other scripts.
Type | Name | Signature |
---|---|---|
function | eval | var eval(string, string[]) |
function | incl | var incl(string) |
var eval(string path, string[] args)
Evaluate another script, which would share the global variables and bindings with the caller script.
Unlike incl()
, results won't be cached. When evaluating files in a chain, attempt to target the same file twice results in exception.
Do not mimic this function in a user-defined script. Special handling is performed inside the engine to greenlight calling Environment.evaluate() from a global function defined in this built-in script.
Required Policies
System.Environment/eval
Parameters
Returns
var incl(string path)
Include another script. Semantically equivalent to include
statement, this function can be called anywhere inside from the outermost scope in a loose script, and due to being a function, it allows the caller to get the returned value.
Same file will be included once only. Recalling this against the same path returns the cached result. When including files in a chain, the inclusion on the same file from the 2nd time will be skipped and a null
value is returned instead since the actual result is yet to be determined.
Do not mimic this function in a user-defined script. Special handling is performed inside the engine to greenlight calling Environment.evaluate() from a global function defined in this built-in script.
Required Policies
System.Environment/eval
Parameters
Returns