List All Global Variables

robinathome

Member
Licensed User
Longtime User
Hello all,
I need to debug a programme and I would like to export all Global Variables and their values to a text file. Arrays I will deal with separately. Something like
fileopen(c1,"Variables.txt",cWrite,cAppend,cASCII)
For n = 0 to App.GlobalVariables.count-1
filewrite(c1,App.GlobalVariables(n).name & "," & App.GlobalVariables(n).value)
next
fileclose(c1)


If this can work with all modules then that would be great.
If this question has already been answered then please can you point me in the right direction.
Thanks
Robinathome:sign0085:
 
Last edited:

agraham

Expert
Licensed User
Longtime User
I'm afraid this is not possible as there is no collection of Global variables that can be iterated and you can't get the value of a Global variable as a property.

If you can't for some reason debug in the IDE and can optimise compile your application you can debug it on either desktop or device with my http://www.b4x.com/forum/additional-libraries/2328-debug-library.html#post12598 which can (amongst other cool things) inspect and change Global variables at runtime. With the next version of Basic4ppc will come an update to this library providing single-step and breakpointing.
 

robinathome

Member
Licensed User
Longtime User
agraham

Thank you for pointing out your Debug Library and I have just tried the Watcher to find the current value(.text) of variables. This will suffice for the moment.:)
 
Top