Page 1 of 1

Referencing objects with strings

Posted: 17 Sep 2012 19:16
by RufusWhite
Is there a way when scripting in Lemur to reference an object with a string?

For example if I have a grid of buttons:

container.button1
container.button2
container.button3

how can I reference them programmatically based on an input from another control/midi cc, eg:

container.button(MIDI_ARGS[0])

There doesn't seem to be any mention of this in the manual, and I've tried everything I can think of!

Many thanks!
Rufus

Re: Referencing objects with strings

Posted: 18 Sep 2012 13:31
by nick_liine
Hi Rufus,

Lemur can't combine strings like that. What you could do to reference objects programmatically is to use the findobject() function.

Code: Select all

decl foo={'Knob1','Knob2','Knob3'};
decl bar=findobject(foo[2]);
setexpression(bar,'x',0.1);
See attached JZML.

Hope this helps,
NB