General

Referencing objects with strings

Started by RufusWhite on .

Sign in or create an account to join the conversation.

2 posts

Topic starter
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
Hi Rufus,

Lemur can't combine strings like that. What you could do to reference objects programmatically is to use the findobject() function.
decl foo={'Knob1','Knob2','Knob3'};
decl bar=findobject(foo[2]);
setexpression(bar,'x',0.1);
See attached JZML.

Hope this helps,
NB

foobar.jzml