Thanks, that's been useful. I had a wrong mental model of how macro storage
worked which made me look in the wrong places. In case anyone ever happens
to find this while doing the same in the future, I ended up writing this
function (to be called from a widget's member function):

function getVariables(widget)
{
    var node = widget;
    var result = [];
    while (node) {
        if ($tw.utils.hop(node, "variables") ) {
            result =
result.concat(Object.getOwnPropertyNames(node.variables));
        }
        node = node.parentWidget;
    }
    return result;
}

But the important realization is that macros/variables are not all stored
in place but are rather context-dependent, i.e. are a collection of
variables defined at any of the parents of the current context. Which is
probably not news to any of you :) but it's what tripped me up.

cheers,

roel



On Thu, May 28, 2020 at 4:47 PM PMario <[email protected]> wrote:

> see:
> https://tiddlywiki.com/#dumpvariables%20Macro:%5B%5Bdumpvariables%20Macro%5D%5D%20%5B%5Bdumpvariables%20Macro%20(Examples)%5D%5D
>
> -m
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywikidev/4df83c11-95fb-4336-b54a-48e420ea503c%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywikidev/4df83c11-95fb-4336-b54a-48e420ea503c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/CAPjiA7bS%2BY7vhKE0YwvQ_bfsxOQOqKU0bRv0xs_kOd%3DPcRXarw%40mail.gmail.com.

Reply via email to