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.
Specifications
Link to specifications
- 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.
Example
Link to example
Let's say we have two scripts: a.zs
and b.zs
.
a.zs:
ZenScript Copystatic myVal as string = "myVal";
function makeLine() {
print("---------------");
}
b.zs
ZenScript Copyprint(scripts.a.myVal);
scripts.a.makeLine();