-
Notifications
You must be signed in to change notification settings - Fork 0
Module Quick Start
cyberbit edited this page Jul 25, 2026
·
2 revisions
A simple multi-file module example:
--- staticExample/init.lua
return function (api)
-- input, output, and middleware can be exported, but are all optional
return {
input = {
-- 'parentFolder.ClassName' pattern is tested for multi-file, single-file, and Luz modules
-- other require patterns may work but are not officially supported
static = api.require 'staticExample.StaticMetricInputAdapter',
},
-- output = {},
-- middleware = {},
}
end--- staticExample/StaticMetricInputAdapter.lua
return function (api)
-- vendor modules are available from api.vendor
local fl = api.vendor.fluent
-- instantiate a new input adapter class
local StaticMetricInputAdapter = api.mintInput('StaticMetricInputAdapter')
function StaticMetricInputAdapter:constructor ()
self:super('constructor')
end
-- input read entrypoint
function StaticMetricInputAdapter:read ()
return api.MetricCollection{ static = 1 }
end
return StaticMetricInputAdapter
endThe single-file equivalent can be trivially created by replacing api.require with the function from the required file. Luz modules are built from single-file modules using lua bin/luzc.lua module.lua module.luz.
For more complicated base adapter setups, see the Advanced Peripherals module source.