3 Parameter Section
Target Parameters Reference  / 

4 Runtime Evaluation Order

Running a script can be done in several ways:

In the first two cases, one can also provide arguments on the command line. In the last case, the args section in the current script is used as input.

When running a script, the following happens:

  1. The script and all its imports are parsed, recursively, to construct its parameter tree and argument (default value) tree.
  2. If the script is not the top level script to run, then all arguments have been assigned already. If it is the top level script, then the arguments are assigned as follows:
    1. The argument tree is taken from the args section in the script, then it is overridden using any arguments on the command line, or using the args section in the script containing the target key.
    2. Assign parameters using the default values specified in the parameter definitions.
    3. Assign parameters from the argument tree, overwriting any assignments from default values.
    4. Check that all required parameters have been assigned.
    5. Check that everything in argument tree has been used to assign parameters.
  3. Any associated pre-init code is run. It can use params.setdefault to assign parameters. If the parameter is already assigned this statement has no effect.
  4. All mentioned blueprints are expanded, using the same blueprint builder (unless the blueprints are included via a script inside an array namespace, in which case each one has its own builder). All blueprints are then instantiated.
  5. The associated code is run. It can use params.setdefault to assign parameters. If the parameter is already assigned this statement has no effect.

Note that a script containing a target key may itself be called by another script using the target key. It follows from the above that the arguments from the caller script overrides the callee, and by induction, in a series of caller script the arguments from the outermost script are used.

3 Parameter Section