Displaying the names, types and values of variables

More of a general Squirrel question than something Imp specific…

In order to enable general debugging it is often valuable to display a number of different variables from different places in an application. In order not to have to do a number of custom server.log(format(" %? %?", value, value) statements, I am trying to get it done by simply passing the required variable(s) to a function from where I can do it as follows:

function ShowVariable(....) { foreach (idx,val in vargv) { server.log("Name= " + member + " : Type= " + typeof(val) + " : Value= " + val); if (((typeof val) == "array") || ((typeof val) == "table")) ShowTable(val); } }

This works perfectly to get the value and the type of the variable, but problem comes in that I cannot find a way to display the name of the variable to help with debugging.

Even if I could get the name of the variable in the calling routine then for each variable I could pass the name of the variable and the value of the variable as 2 parameters per variable?.

Any suggestions out there?

Andre

good idea! try this.

foreach(idx,val in getroottable()){ server.log(idx + " " + val); }