# `ResultReference` (parameter type)

Reference parameters allow users to select a result from a different tool to use as a parameter for the current tool. A reference parameter targets one or more result types, and is shown as a ui-control populated with all tool results that match the specified types.

A tool which references a result from another tool will execute after that tool.

The `Tool.reference` function is used to specify a reference parameter in the parameter definition:

>         {name="MyReference", type=Tool.reference('Point', 'Shape')}

The value of a result reference parameter should be passed as the argument to `input:getResult` in `execute` to retrieve the value of the currently selected result:

>       local ref = input:getResult(self.parameters.MyReference)
>       if ref ~= nil then
>         if Object.getType(ref) == "Point" then
>           print("Referenced point: "
>                 .. tostring(ref:getX()) .. ", "
>                 .. tostring(ref:getY()))
>         end
>       end

The reference choice is presented as a drop down menu in the user interface, with a `None` option and the names of results of matching type for all tools in the same job:

> The appearance of a parameter with type=Tool.reference(“Point”) in the tool panel.

Note

Result references can also be used as elements in enum parameters.