Skip to content

require

require(module) loads and executes a Lua module. CWD-jailed, searching the job’s directory first, then falling back to the project root. Dots in module names convert to path separators (e.g. foo.barfoo/bar). Modules are cached after first load.

require(module)
sync
Param Type Description
module string Module name (dots converted to path separators)
Value Type Description
result any Return value of the module
-- In hooks.lua
local utils = require("utils")
local result = utils.process_data(data)
-- In utils.lua (same job directory)
local M = {}
function M.process_data(data)
return data:upper()
end
return M