the script source code you want to interpret
the filename of the script, if you want to provide it. Gives nicer error messages if you provide one.
The global object of the script context. It will be modified by the user script.
the result of the last expression evaluated by the script engine
var globals = var.emptyObject; interpret(`function foo(name) { return "hello, " ~ name ~ "!"; }`, globals); var result = globals.foo()("world"); assert(result == "hello, world!");
This is likely your main entry point to the interpreter. It will interpret the script code given, with the given global variable object (which will be modified by the script, meaning you can pass it to subsequent calls to interpret to store context), and return the result of the last expression given.