7 wishes: 4 - create some global "document inventory variables"

The binding is global to scripts (velocity, groovy …)
I would like to have sone global variables (type list) containg things like

a list of headlines (title, depth)
a list of images (id, link, src ...)
a list of tables (id, kind: live table ...)

This would make it easier to

create overview lists within the document with the help of a script macro.
create links to "previous section" or "next section"


Sorry, I don’t understand the use case. Could you explain a bit more? Thx