Qbik Helpsys

Run Lua script

License restriction: The Run Lua script event processor is only available when using a WinGate Professional or WinGate Enterprise license.

The Run Lua script event processor allows you to configure a Lua script that will be executed whenever the selected event takes place.

The Lua runtime (script execution) environment has access to the full set of event data and global data items provided by the WinGate Data system. You can access these by directly typing the relevant variable names into the script edit window or browsing for them using the Symbol Browser. These will be parsed to provide the latest data values at the time the event occurs.

You can also use Lua modules to gain access to other functionality provided by these modules, such as file system access, network services, access to COM objects etc. This makes the Lua script event processor very flexible and powerful.

By default, an empty function called filter is provided in the Lua script event processor configuration (Shown below). The parameters of the filter function inside the parentheses will vary in appearance, depending on the event that the Lua script will process. Do not modify any of the filter function definition, as this will prevent the function from working correctly. Simply enter all Lua script inside the body area of the filter function, that you wished to have processed whenever the script is run.

To use the Run Lua script event processor:

  1. Open the WinGate Management console.
  2. Navigate to Control Panel > Events.
  3. On the Events panel, right click on the registered event that you want to specify processing for, and select Specify processing to open the Specify event processing dialog.
  4. Click the Add button to open the Add Event Processing System dialog, where all of the available event processors will be listed.
  5. Select the Run Lua script option to open the Lua script item properties.
  6. In the filter function body, enter the Lua script expressions that you wish the Lua script event processor to evaluate and process.

    All scripts must conform to Lua rules. The Lua script event processor in WinGate uses Lua 5.1. Documentation for Lua 5.1 is available online at http://www.lua.org/docs.html

    You can insert WinGate object methods and event data into the Lua script expressions by placing the cursor at the desired location in the statement and clicking the Insert symbol button to open the Symbol Browser.

  7. Once you have finished entering configuring the Lua script, click OK to return to the Specify Event processing dialog, where the Lua script event processor will be listed.
  8. If there is more then one event processor configured to respond to the event, then you can use the arrow to define the order that the configured event processors will be actioned whenever the event takes place. When there is more then one event processor configured, the order of processing is also displayed in the Event processing pane on the Events panel.

You can use basic Full-Text Searches against the page title and body to find matching articles. Use the following search modifiers to refine your query:

  • event management (no quotes) will find all pages containing the words "event" OR "management"
  • "event management" (with quotes) will find all pages containing the phrase "event management"
  • +event -management will find all pages containing the word "event", AND NOT the word "management"