To be a bit more technical, a Lua script is treated the same as a function body. So you can use
return
to exit your script. If you're writing a script you want to call from the command-line you may return an integer number, which will then be visible as the exit code of the octane process.
You can also call the error function:
error("oops")
to raise an error. The effect depends on the context:
- Raising an error in the main script (or in any function called directly from there) will stop the script. When called from the command line, this results in a non-zero exit code.
- Raising an error in a render callback will stop the render.
- GUI callbacks should not raise errors, you'll have to add some handling yourself to close any open dialogs.
os.exit()
will exit the application, but I recommend not using this function as it can interfere with the authentication management. For batch processes, use the
--stop-after-script
or
--no-gui
option instead to exit octane after the script finishes.
--
Roeland