Skip to main content

Examine the Example

Let's examine some pieces of the example module to see how they interact to create a scripting function.


This is not an exhaustive list of every file or class required to make this example work. We encourage you to examine the other directories included in this example project to see how they all fit together.


The common directory defines the interface and abstract class that all the implementing functions must adhere to, regardless of scope. This directory contains the files that define the function itself:



The AbstractScriptModule class defines the function and its arguments:
@ScriptFunction(docBundlePrefix = "AbstractScriptModule")
public int multiply(@ScriptArg("arg0") int arg0,
@ScriptArg("arg1") int arg1) {

return multiplyImpl(arg0, arg1);


The AbstractScriptModule implements the abstract class MathBlackBox to provide the math behind the multiply() scripting function:
package com.inductiveautomation.ignition.examples.scripting.common;

public interface MathBlackBox {

public int multiply(int arg0, int arg1);



An instance of ClientScriptModule is used in the Designer and Client scope to provide details about the function. The ClientScriptModule class creates the actual RPC handler, using the API's ModuleRPCFactory.create() method:

public ClientScriptModule() {
rpc = ModuleRPCFactory.create(

The ModuleRPCFactory handles passing values back and forth between scopes.


When executed, the ModuleRPCFactory will automatically call the GatewayHook's getRPCHandler method, which returns the GatewayScriptModule with the actual implementation of MathBlackBox:

package com.inductiveautomation.ignition.examples.scripting.gateway;

import com.inductiveautomation.ignition.examples.scripting.common.AbstractScriptModule;

public class GatewayScriptModule extends AbstractScriptModule {

protected int multiplyImpl(int arg0, int arg1) {
return arg0 * arg1;