Cross-Script Reference

Link to cross-script-reference

All scripts that have static variables or custom functions are registered to the cross-script reference.
This allows you to access these fields/functions using the dot-notation.

  • Cross-script references start with scripts.
  • You specify the path relative from the scripts folder (e.g. scripts.mySubfolder.a.zs)
  • You can use the dot-notation in an import statement should you choose to do so.
  • ZS first checks for matching directories then for matching files or values.

Let's say we have two scripts: a.zs and b.zs.

a.zs:

ZenScript
Copy
static myVal as string = "myVal";

function makeLine() {
    print("---------------");
}

b.zs

ZenScript
Copy
print(scripts.a.myVal);
scripts.a.makeLine();