There may be another way but the easiest would be just to send the var name to the function as a parameter.
Code:
numberVar := TestFunction( 1234, "numberVar" )
msgbox % numberVar
TestFunction( arg, var="" ) {
return "Value: " arg "`nVariable Name: " var
}
Hard, and not 100% perfect method
Code:
numberVar := TestFunction( 1234, a_lineNumber ) ; the a_lineNumber parameter is essential or the function will fail.
msgbox % numberVar
TestFunction( arg, Ln ) {
fileReadLine, vLn, % a_scriptFullPath, % Ln
return "Value: " arg "`nVariable Name: " regexReplace( vLn, "[\s:=]+[\w(),;.""""]+" )
}
There maybe some extra patterns that can sneak their way past the regexReplace
( sorry I'm new to rE )
