# Interface `parameters`

The parameters interface provides access to the current values of tool parameters. It is accessed with `self.parameters` from within tool extension methods.

parameters:getRegion()
  Return type:

    `Shape.Composite`

  Returns the standard region of the tool, as it is currently configured, without any transformations applied.

  See also `input:getTransformedRegion` and `input:getTransform` for applying transformations from parent tools to the region.

parameters:getTeachState()
  Return type:

    `Nova.Types.TeachState`

  Gets the current teach state for the tool.

parameters:isTeachDisabled()
  Return type:

    `boolean`

  Gets whether teach is disabled or not for a tool. Teach is disabled if there is no reference image included in the job. When teach is disabled, parameters with `affectsTeach=true`, see Parameter definition, are disabled.

parameters:setTeachState(value)
  Argument:

    - value (`Nova.Types.TeachState`)

  Sets the current teach state for the tool. The teach state is used in the tool’s teach panel.

## Parameter access

The tool parameters specified in the parameter list to `Tool.register` are accessed as properties by name: `self.parameters.`ParameterName.

The type of the property depends on the parameter type in the registration of the accessed parameter, for example a Lua `integer` for “int”.

Example

For this parameter list:

    parameters={
      {name="MyInteger", type="int", range={0,10}},
      {name="MyIntegerRange", type="intrange", range={0,100}},
      {name="MyOptionalValue", type="int", default=10, optional={default=true}},
    }

The parameters are accessed from within the `execute` method with the following syntax:

    local intValue = self.parameters.MyInteger

    local range = self.parameters.MyIntegerRange
    local lower = range[1]
    local upper = range[2]

    -- Optional parameters have an extra step of indirection
    local optional = self.parameters.MyOptionalValue
    local optionalEnabled = optional.enabled
    local optionalValue = optional.value

    -- Alternatively
    local optionalEnabled = self.parameters.MyOptionalValue.enabled
    local optionalValue = self.parameters.MyOptionalValue.value

The value of `self.parameters.MyInteger` is the configured integer value of that parameter for the tool instance, within the limits 0-10. See int (parameter type) for more details.

The value of `self.parameters.MyIntegerRange` is an array with two integer values, specifying the currently configured range, both within the limits 0-100. See intrange (parameter type) for more details.

The value of `self.parameters.MyOptionalValue` is a table with two fields: `enabled` and `value`, where `enabled` is `true` if the parameter is enabled, and `value` is the integer value the parameter is configured to. The value can be accessed even if the parameter has been disabled. See Optional parameters for more details.