Imports
Every function defined in a .scrs
file can be imported by another file (unless explicitly told not to export it). Importing a function also imports all of its dependencies.
To import functions, use the import
keyword:
You can also include specific functions:
Or you can import all functions into a function namespace:
However, you cannot import specific functions into a function namespace:
Standard
ScratchScript has a few standard scripts which include improvements to the language itself. All of them are contained in the std
namespace, and any other file is not recommended to utilize it.
The standard currently includes these namespaces:
std/math
(max()
andmin()
)std/string
(string extensions, likereplace()
,substring()
and others)std/string/unicode
(unicode string handling,unicodeOf()
andunicodeFrom()
)
There is also a std/global.scrs
file which includes necessary functions for the compiler (like __Ternary()
, __Exponent()
, etc.), and is hence imported in every ScratchScript file by default and cannot be removed.