Page 1 of 1

Indirect Script Reference

Posted: 03 Mar 2017 15:21
by ForestCat
I'm familiar w/ the use of findobject(), getobject(), getexpression(), setexpression(), etc, etc, when using strings to reference objects/expressions in functions that need direct (literal dot-notation) address references.

However, I've had no joy trying to run scripts in this fashion. Example:

A script, script2(val) in Container3, inside Container2, inside Container1, that accepts 1 argument:

Monitor.value = val;


A script in Container1 that needs to run script2():

Container1.Container2.Container3.Script2('Hello World'); // the standard 'direct' reference


What I Need:

decl rootStr = 'Container1.Container2.Container';
decl i;
for(i=0;i<9;i++){ // for Container0 thru Container9
execscript(rootStr+i ,'Hello World'); // imaginary execscript() function to allow script execution by string reference
}

I know that I could attach the target scripts to variable 'val' and have it trigger on a value change but that's such a hack.
Does anyone know of a way to execute a script via a variable reference to the script name?

Thanks so much.

Re: Indirect Script Reference

Posted: 06 Mar 2017 18:25
by midikinetics
Nope!

This would be on my top 3 of requested Lemur functions (including string/character manipulation and much more memory), allowing us to approach something like object orientation.

Something like:

Code: Select all

executeScript(object, 'scriptName', args)
And overloaded versions:

Code: Select all

executeScript(object, 'scriptName', args1, args2)
It's before my time but I believe the original Lemur even had createObject(...) and destroyObject(...)

MOH