Skip to content

pymsg.list_message_handlers

Daniel Flassig edited this page Jun 17, 2026 · 1 revision

Discovers which message handlers are currently available for a topic. This is a pure look-up: no handler code is executed.

pymsg.list_message_handlers(message)
Parameter Type Description
message string The topic to look up. Either the long form PUBLISHER-GUID/TOPIC, or a short topic TOPIC (in which case the calling plugin's own GUID is assumed as the publisher).

Return value

Returns an array (a Lua table with integer keys starting at 1) of the handlers registered for the topic. The array is sorted by caption. Each entry is a table:

Field Type Description
address string An opaque, stable token identifying this specific handler. Pass it to pymsg.send_message to invoke this handler. The same handler always has the same address (see pymsg), so it may be stored and reused across sessions.
caption string The handler's caption (see Message Handler Extension).
description string The handler's description.

If no handler is registered for the topic, an empty array {} is returned.

Example:

local handlers = pymsg.list_message_handlers("PRICE-REQUEST")

if #handlers == 0 then
    pyui.alert("No price-calculation plugin is installed.")
    return
end

-- invoke the first available handler
local status, result = pymsg.send_message("PRICE-REQUEST", handlers[1].address, part, {})

Remarks:

Because several plugins may register a handler for the same topic, the returned caption/description can be presented to the user so they can choose which handler to call.

Version Support:

Minimum PYTHA Version: V26

See also:

pymsg, pymsg.send_message, config.xml: Message Handler Extension

Clone this wiki locally