I'd like to implement a function which takes in an object and a string and returns the property of that object with name that is specified by the string. For example, say my function is named foo, than the following two lines would be equivalent:
x = myObj.myProp
x = foo(myObj, "myProp"
I have an inkling on a complicated way to do this, but I wanted to see if there was a real simple way.... like is there an eval statement or something that takes in a string and runs it as if it was code?
-Venkman
x = myObj.myProp
x = foo(myObj, "myProp"
I have an inkling on a complicated way to do this, but I wanted to see if there was a real simple way.... like is there an eval statement or something that takes in a string and runs it as if it was code?
-Venkman