-
Notifications
You must be signed in to change notification settings - Fork 10
Scripts
Positron edited this page Aug 3, 2017
·
3 revisions
When a script has no parameters, the void
keyword is not necessary. The
parentheses are not required either:
// These are all the same:
script "Test" ( void ) {}
script "Test" () {}
script "Test" {}
The name of a script parameter is optional. You still need to pass an argument for an unnamed parameter, but you won't be able to use such a parameter. An unnamed parameter can be used to indicate to the user that a parameter is no longer used.
script "Test" ( int used1, int, int used2 ) {
Print( d: used1 + used2 ); // Output: 400
}
script "Main" open {
ACS_NamedExecute( "Test", 0, 100, 200, 300 );
}
A script cannot have optional parameters.
In a script, the magic identifier, __SCRIPT__
, is a string literal that
contains either the name or number of the current script:
script 123 open {
Print( s: __SCRIPT__ ); // Output: 123
}
script "abc" open {
Print( s: __SCRIPT__ ); // Output: abc
}