I'm looking for a Lingo equivalent to the eval() or evaluate() function
that exists in some other languages. It returns a pointer to the variable
whose name is passed to it as a parameter.
Let's say, I have a string variable named MyStrVariable. And its value is
"The Great American Value". If I have a Lingo eval() function, then I can
do this:
put eval("MyStrVariable")
--"The Great American Value"
This would be handy, e.g., in parsing a preferences file:
[Settings]
intFontSize=12
strFontName="Times New Roman"
...
I could read these pairs and so long as my variables are named
"intFontSize", "strFontName" etc., it would be a cinch to set the
variables' values to the settings from the pref file:
the itemDelimiter = "="
varName = the first item of strPrefs.line[i]
varValue = the last item of strPrefs.line[i]
eval(varName) = Trim(varValue)
(where Trim() strips spaces)
If there's no equivalent to eval() in Lingo, how do the pros do this?
Thanks!
Slava
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]