Docs / Language & functions
a9script authoring pack — resources functions
The resources functions, with their arguments and a line of real script each. Called by bare name; nothing is imported. A call marked pauses does real work outside the script: the run is saved, and continues on the next line with the result.
readResource(name) — pauses
Reads the text of one of this environment’s resources — requirements, instructions, reference data written beside the scripts that use it. Read afresh at each call: an activated change reaches the next read, and a value read earlier in the run stays what it was.
name(string) — The resource’s name, as the environment shows it.
Answers: The resource’s text, whole (at most 64 KiB). A name the environment has no resource for throws RESOURCE_NOT_FOUND. JSON text is parsed with JSON.parse(readResource(name)).
const brief = readResource("support-brief");
log("the brief has " + brief.length + " characters");