Skip to content

main

Every patch must have a main function. This function is the entry point for the patch and is called every time the patch is run.

The function must return a single value or an array of values. The return value can be a string, number, boolean, or a Sup component, like SupImage or SupAudio.

Usage

function main() {
return "sup, world!";
}

Valid return types

string | number | boolean SupImage SupAudio SupVideo SupHTML SupSVG Array<...>

Interactions

Patches that are interactive (e.g. using buttons or onThreadReply) will automatically re-run the main function when the user interacts with the patch. If the main function returns a different value, the new value will be displayed in the chat for all users.