return (without gosub) - coldrockgames/doc-scriptor GitHub Wiki
return <expression>
The return
command is also a simple way to terminate a script. It functions similarly to the return
statement in other programming languages.
If you add an expression to the return
statement, this becomes the return value of the script.
You can access the return value in GML through scriptor.get_result()
.
You can return anything, just like you can return anything with a GML "return" statement.
You have 2 ways to access the result in GML:
- As direct return value like
var result = scriptor.run();
- Any time after the
.run()
call throughscriptor.get_result();
Note
The result of a preceding run is reset, when the .run()
method of a scriptor is invoked (again).