Global Lua Module

When writing custom Edge rules with Edgelang, sometimes you need to call a custom Lua module, you can add this Lua module with the Global Lua Module.

1. Create a global Lua module

Let’s see how to create a global Lua module and reference it in Edgelang.

First click on Global Configuration.

Then click Global Lua Modules in the left navigation bar to go to the Global Lua Modules page.

On this page, the global Lua modules that already exist are listed, and we click New Lua Module to create a new one.

The following two methods are supported

  1. Fill in the Module name column with the name of the module to be referenced later, and fill in the Lua code in the edit box of the Lua code column
  2. Click Select File to import the existing Lua module directly, the module name is the file name by default

After editing and clicking save, the Lua module will be automatically distributed to each node and can then be referenced in the Edgelang code

2. Sync option

At the top right of the page is the Sync option, which meaning is the same as Global Config

The difference is that when Automatic Synchronization is unchecked, Global Lua Modules supports copying a particular Lua module to the specified partition individually in addition to copying all Lua modules to the specified partition, let’s click on the Copy button.

Then select the partition you want to synchronize and click copy, the configuration of the current partition will overwrite the configuration of the specified partition.

3. Change log

We can see the change log of Global Lua modules under the same partition on the Releases page. Let’s click the Releases button

Find the corresponding release history, click Click for details.

We will see the change log.