Expand documentation of RegionData object graph and ComposedSort paths
albertbori opened this issue · 3 comments
Is your feature request related to a problem? Please describe.
I'm attempting to learn to use the custom sorting functions (including composition-sort) in dynamic groups. I've read the documentation here: https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Dynamic-Group#regiondata
The problem is that I'm unable to see all possible composition paths available to sort by. The object graph sample gives "hand-waivy" example values, like region = {...}
. Further down in the documentation, it gives the helpful composition-style examples of the following, but fails to enumerate all possible paths:
WeakAuras.ComposeSorts(
WeakAuras.SortAscending{"region", "state", "stacks"},
WeakAuras.SortDescending{"region", "state", "expirationTime"}
)
Describe the solution you'd like
I would love to have more complete documentation of the possible paths to use for the composed-sort functions. (or at least a more complete version, within reason)
Describe alternatives you've considered
I spent a few hours trying to print out these objects on the fly to inspect them, but it is very difficult to do from within the game. I even wrote my own custom lua table dump, but the information was unintelligible to the layman.
Available properties in region.state table will depend on which trigger you use, and custom TSU triggers let you set your owns.
It's tedious to document every single properties available for each trigger, but you can see most of which are available in the tooltip when you hover text fields in the display tab of a selected aura.
What i can recommend to explore tables instead of printing & dumping is to use https://www.curseforge.com/wow/addons/varrendevtool with the command ViragDevTool_AddData(aura_env.region.state, aura_env.id)
Yeah, the regionData objects are not exactly "user-friendly" - this is somewhat by design. The "region" and "data" fields of those objects are living things that WeakAuras uses in many places throughout the addon, and I don't especially wish for users to feel comfortable poking around in there - that's a hood way for ✨weird things✨ to appear, which become complicated to maintain around.
The dynamic group functions expose "raw" internal machinery like this for two reasons:
- builtin functionality is constructed to use the same machinery, and adding extra bells to safe-ify custom code is (so far) not worth the trouble
- I am curious to see what neat things people might come up with. Useful (but missing) features sometimes reveal themselves from the ways in which clever users "break" WeakAuras.
For a proper understanding of what those objects are & what information they contain, consider examining the source code here which creates & manages the regionData objects.
The "region" and "data" fields of those objects are living things that WeakAuras uses in many places throughout the addon.
To expand on this point a bit, the "region" is the object which directly corresponds to the visible bit of an aura, and the "data" is the actual data that lives in the savedvariables file. They're included here partly because users have found novel ways to combine the information these things hold to do nice things, but knowing what each piece of them is for somewhat necessitates an understanding of the general mechanism of WeakAuras.
For the reasons outlined above this is somewhat deliberately kept as an undocumented space, so that ✨weird innovation✨ doesn't spread too quickly without us developers able to keep up.