Skip to content

system.registerSystemTool

since 1.1.0

Register a Lua System Tool.

system.registerSystemTool(params)

Parameters

Name Type Required Description
params table yes see the fields below

Fields of params:

  • name (string or function): tool name
  • icon (string): tool icon
  • create (function, optional): handler called on widget creation, it will return the widget which is passed later to all functions
  • wakeup (function, optional): handler called at each loop
  • event (function, optional): handler called when an event is received (event not passed to the parent window if the handler returns True)
  • paint (function, optional): paint function
  • close (function, optional): handler called on page closed
  • title (boolean, optional): title

Returns

page index (integer)

Examples

From the official Ethos documentation
local function init()
  system.registerSystemTool({name=name, icon=icon, create=create, wakeup=wakeup, event=event, paint=paint})
end

Used in

Real-world usage

Called 20 times across 8 open-source Ethos Lua projects. A few short excerpts:
local function init()
  return system.registerSystemTool(tool)
end

src/rfsuite/app/tool.lua:634

local function init()
    system.registerSystemTool({name="GPS QR Code", icon=icon, create=create, wakeup=wakeup, paint=paint})
end

gps-qrcode/main.lua:185

local function init()
  if system.registerDeviceConfig ~= nil then
    system.registerDeviceConfig({category = DEVICE_CATEGORY_RECEIVERS, name = name, bitmap = icon, appIdStart = 0x0C30, appIdEnd = 0x0C30, version = LUA_VERSION, pages = { page }})
  else
    system.registerSystemTool(page)
  end
end

lua/frsky/SR6MiniE_Cali/main.lua:117