Miscellaneous
Miscellaneous functions are described in the following table.
Miscellaneous Functions
Syntax
Effect
stop( )
Stops the execution of the program at the current statement and, if the debugger is enabled, enters in debug mode.
write(arg1, ..., argn)
writeln(arg1, ..., argn)
Converts the arguments to strings and prints them to the current debug output. The implementation of this depends on the application in which Script is embedded. The function writeln prints a newline at the end of the output, while write does not.
loadFile(string)
Loads the script file whose path is string. The path can be either absolute or relative. If this path does not designate an existing file, the file is looked up using a method which depends on the application in which Script is embedded; typically, a file with the name string is searched in a list of directories specified in the application setup.
eval(string)
Executes string as a program, and returns the value of the last evaluated expression. The program in string can use all the features of the language, except that it cannot define functions; in other words, the function statement is not allowed in string.
Examples:
  eval("2*3") −> 6
  eval("var i=0; for (var j=0; j<100; j++) i=i+j; i") −> 4950
  n=25; eval("Math.sqrt(n)") −> 5
  eval("function foo(x) { return x+1 }") −> error
Published date: 05/24/2022
Last modified date: 02/24/2022