Local variables by reference?

Can one access the values stored in local variables without explicitly writing out the name of the variable? I'm after some function func that acts as follows:
variable var = 5
print func("var")
...would print 5.

I'd like to store the local variables/strings generated by some Igor functions (e.g. wavestats) in a wave, but want the saved outputs to be determined by instructions in a string rather than hardcoded into the function (e.g. the user might pass "V_avg;V_sdev;V_maxloc;" with the intent of generating an output wave holding these values). However, wavestats' output are local rather than global variables, so the $-based reference won't work. Is there a reference system for local variables, or a function like the above that can do this? Many thanks!!
Keep in mind that local variables are accessible *only* from within the function in which they were created and that they cease to exist when the function returns. That's what makes them local.

Quote:
(e.g. the user might pass "V_avg;V_sdev;V_maxloc;" with the intent of generating an output wave holding these values)


You would have to do something like this:
Function Test(w, list)
    Wave w
    String list     // e.g., "V_avg;V_sdev;"
   
    WaveStats/Q w

    Make/O/N=3 output = NaN
    if (WhichListItem("V_avg",list) >= 0)
        output[0] = V_avg
    endif
    if (WhichListItem("V_sdev",list) >= 0)
        output[1] = V_sdev
    endif
    if (WhichListItem("V_maxloc",list) >= 0)
        output[2] = V_maxloc
    endif
End