Section StavesGroups
StavesGroup utility functions
Summary
Return type | Function and summary |
---|---|
table | ChooseStavesGroups(Score score, boolean multiple, boolean visibleOnly, function filterFunc, function selectFunc) Ask the user to choose one or multiple staves groups. |
table | GetStavesGroups(Score score, Staff staff) Get all StavesGroups of the score or containing staff if this argument is provided. |
table | GetStavesInGroup(StavesGroup sg) Return an array of staves in StavesGroup sg |
string | StavesGroupName(StavesGroup sg) Return the name (title) of sg or build a name from its first and last grouped staves. |
Functions
GetStavesGroups(Score score, Staff staff)
Get all StavesGroups of the score or containing staff if this argument is provided.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | score | |
staff | Staff | nil | If nil , return all StavesGroups of the score, else return the ones containing staff. |
- Return
- table: An array of StavesGroups, ordered from first to last Staff (Score.FirstStavesGroup is the first created in the document, not the first printed). Array is empty if no StavesGroups found.
- Error
- if score is not a Score or staff is not a Staff
GetStavesInGroup(StavesGroup sg)
Return an array of staves in StavesGroup sg
Parameter | Type | Default | Description |
---|---|---|---|
sg | StavesGroup | sg |
- Return
- table: Array of Staff
StavesGroupName(StavesGroup sg)
Return the name (title) of sg or build a name from its first and last grouped staves.
Parameter | Type | Default | Description |
---|---|---|---|
sg | StavesGroup | sg |
- Return
- string: Unstyled string
- Error
- if sg is not a StavesGroup
ChooseStavesGroups(Score score, boolean multiple, boolean visibleOnly, function filterFunc, function selectFunc)
Ask the user to choose one or multiple staves groups.
Parameter | Type | Default | Description |
---|---|---|---|
score | Score | score | |
multiple | boolean | true | true if several staves groups can be chosen, false if only one staves group can be chosen. |
visibleOnly | boolean | true | true if only visible staves groups are provided. |
filterFunc | function | Function that receives Score and StavesGroup arguments, returns true if the staves group appears in list, false if not. | |
selectFunc | function | Function that receives Score and StavesGroup arguments, returns true if the staves group is selected by default, false if not selected. |
- Return
- table: Array of choosen staves groups, can be empty, or
nil
if user canceled the choice.