Added in 1.9.0

$submenu($id($1))

Allows you to dynamically create a list of menu items, and can only be called from a menu event.

$id($1) - where $id() is the name of your identifier, and where $1 = 1, and increases by 1 with each call, adding whatever is returned by $id() to the popup menu.

The value that $id() returns must be a one line definition format for a popup menu.

The iteration ends when $id() returns no value.

The begin and end values are sent to check if the item should be enclosed in separators.

Example

menu * {
 Animal
 .$submenu($animal($1))
}

alias animal {
 if ($1 == begin) return -
 if ($1 == 1) return Dog:echo Dog
 if ($1 == 2) return Cat:echo Cat
 if ($1 == 3) return Bird:echo Bird
 if ($1 == end) return -
}