-
Notifications
You must be signed in to change notification settings - Fork 171
Server Scripting
The script will execute in a global environment, and the return value of the initial execution is the script
object.
Some non-standard extensions to JavaScript are present. Since the engine uses an instance of QScriptEngine, Qt's additions are available. If you receive an error, you can get a backtrace using .backtracetext. This is assigned when the exception is thrown and it is a string separated with newlines '\n'.
The script functions are properties of the sys object (with one or two exceptions) and they allow you to interface with the C++ code in a safe way.
The script events are called upon the script object. These methods of the script object that are used by the script engine are called "events". Some events may be stopped with sys.stopEvent()
.
A basic tutorial on making a simple working script that shows some of the JavaScript concepts at work.
A list of sample script tips, other than the one in the basic tutorial: