Passing expression name as argument(solved)

Discuss Lemur and share techniques.
Post Reply
ForestCat
Regular
Posts: 59
Joined: 02 Mar 2012 21:00

Passing expression name as argument(solved)

Post by ForestCat »

OK, feeling pretty stupid this morning. I'm sure there's an obvious, simple way to do this, but I'm spinning my tires...

In Script1:
decl foobar1 = 22;
TargetVarName = 'foobar1';


In Script2:
How does one get/change the value of foobar1 given only TargetVarName?

I'm guessing there's some string function, etc., that I can't find? Something with curly braces vs quotes? I've searched for "indirection", etc., but no joy. get/setexpression() seem to only work for actual objects w/ an "x" parameter? Is there a syntax to reference a non-vector user expression?

Thanks for any insight.

****************************EDIT: OK, one solution, for the sake of future travelers down this road:*****************************

an object, "var", contains two expressions "TargetVarName", and "foobar1", as above

var.TargetVarName = 'var.foobar1'; // the charm is the single quotes

getexpression(var, var.TargetVarName); //returns the actual value stored in "foobar1"

setexpression(var, var.TargetVarName, newVal) // sets the value of "foobar1" to newVal
Post Reply