Global Lua Modules
When writing custom Edge rules in Edgelang, you may sometimes need to invoke a custom Lua module. In such cases, you can add the Lua module through Global Lua Modules.
1. Creating a Global Lua Module
Let’s take a look at how to create a global Lua module and reference it in Edgelang.
First, click Global Configuration:

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

This page lists all existing global Lua modules. Click the New Lua Module button to create a new module.

The New Lua Module dialog provides the following configuration options:
- Module name: The name of the module, which will be used when referencing it in Edgelang.
- Upload Lua file: Click Select file to import an existing
.luafile directly. The module name defaults to the file name. - Lua code: Write Lua code directly in the editor. You can enable Vim mode while editing.
- Run on Startup: When enabled, the Edge Node will invoke this module’s
init_worker()function during the initialization of every worker process at startup. Note: once enabled, any modification to this Lua module’s configuration will trigger a graceful restart of the Edge Node. This option was first introduced in version26.6.1-1.

For example, here is a simple module that returns a greeting:
local _M = {}
function _M.say_hello()
return "hello world!"
end
return _M
After filling in the fields, click the Save button. The Lua module will be automatically distributed to every node, after which it can be referenced in Edgelang code:

true =>
say(foreign-call(module: "custom_lua_module", func: "say_hello"));
2. Synchronization Options
At the top right of the page are the Synchronization Options, which have the same meaning as described in Global Configuration.

One difference is that, when Automatic Synchronization is unchecked, Global Lua Modules supports not only copying all Lua modules to a specified partition but also copying an individual Lua module to a specified partition. Let’s click the Copy button.

Then select the partition to sync to and click copy. The configuration of the current partition will overwrite that of the specified partition.

3. Change History
You can view the change history of Lua modules within the same partition on the Releases page. Let’s click the Releases button.

Find the corresponding release entry and click View Details.

You will then be able to see the changes made in this release.
