Debugging Tools

How one can list the local and global variables?

Thank you @TW_Tones .
I am wondering how we can access to tiddler title through tm-text-operation or other methods inside editor!

This is very helpful Saq!

One more question, can I log only local variables, those are created in the scope of work (explicitly I see them in the code or implicitly? Sometimes I do not know what other variables are accessible to the scope I am working! May be we can divide them into

  • global variables: defined outside the scope but are available everywhere
  • local variables: those are explicitly defined by user or implicitly by system

I am not entirely sure that I understand the question, but you can log all variables that are defined at the place you have the $action-log widget, or selectively name the variables to log:

https://tiddlywiki.com/#ActionLogWidget

Note that there is also the $log widget for use outside of action strings:
https://tiddlywiki.com/#LogWidget

Saq,
I mean in a macro for example I can see what variables are explicitly defined so I can use below script

<$action-log var1=<<x>> var2=...

But I cannot find other variables are available here! For example the targetTiddler in the editor toolbar case above. My question is can I log all those variable someway like below

<$action-log locals>>

Have a closer look at the docs.

<$action-log/> logs all variables.

Alternatively
<$action-log var1=<<x>> $$all="yes"/>

Mohammad,

Here is an unpublished macro mydumpvariables that can help with browsing through variables, you can add a sub filter, and only expand as needed.

my-custom-dumpvariables.json (672 Bytes)

1 Like

Hi @TW_Tones
This is really useful tool! Thank you for sharing!
It help debug Tiddlywiki scripts in a simple way!
I may recommend to convert your post to a wiki post and lets add more descriptions!

Much appreciate!

1 Like