script.jul SCRIPT

Provides helper functions for incorporating other scripts.

All Definitions


TypeNameSignature
functionevalvar eval(string, string[])
functioninclvar incl(string)

Functions


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

  • path Either an absolute path, or a path relative to the calling script.
  • args Arguments in string array. Can be null.

Returns

  • The result of interpreting the specified script. Null if the script is not explicitly returned with a value.

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

  • path Either an absolute path, or a path relative to the calling script.

Returns

  • The result of interpreting the specified script. Null if the script is not explicitly returned with a value.