<-- back to the index of Rosetta examples

# hello world (menu, log)

Create a new menu + action hello() that prints "Hello world!" in the message log.

## Example implementations

awk | lua | py | tcl

## Explanation, step by step

Create a function hello that will be registered as an action. The name of the action and the function is always the same. Action names shall be lowercase.

When the action is called, use message to append a log message.

In the "main" section of the script, register the action using fgw_func_reg(). Then save the script cookie and register a new submenu using it. Registering the submenu with this cookie makes pcb-rnd auto-remove the menu when the script is unloaded.

The menu path starts with /main_menu, because it is also possible to insert menu entries in popups.