Page 1 of 1
String concatenation and arrays
Posted: 23 Jul 2014 20:36
by electrofux
Hello,
can i access distinct array items through the setexpression function or do i have to write the whole array in one go?
something like:
setexpression(currentobj,'values',check[0]);
Or anything similar since the above doesnt really work.
Re: String concatenation and arrays
Posted: 23 Jul 2014 21:35
by oldgearguy
I've only had success creating a temporary array and then using setexpression() to assign it to the object all at once.
check = {0,0,0,1};
setexpression(myBtns, x, check);
At some point in time, I got real tired of trying to figure out clever/cleaner ways and just did it the way I knew worked so I could be done with it. Trying to figure out workarounds every step of the way wore me down.
Re: String concatenation and arrays
Posted: 24 Jul 2014 08:55
by electrofux
i am trying to do it like that. But it is getting really complicated
Would be much easier if i figured out a way to directly change array items with via concatenation and setexpression.
I am building an single interface to control several sequencers in Reason and at the same time implement a bidirectional cc conversion to make the sequencers react to predefined scales. So to not blow the code up i need every clever trick i can come across
Re: String concatenation and arrays
Posted: 24 Jul 2014 11:25
by oldgearguy
I hear you. So, using constructs like currentobj.values = check[0]; or some other type of de-referencing doesn't work? I'm not at a terminal to check it out directly.
Re: String concatenation and arrays
Posted: 25 Jul 2014 10:31
by electrofux
If the currentobj is an object referenced by the findobject funtion this indeed doesnt work for me. The code gets red when i put the array brackets behind it.
But i got around it because getexpression(currentobj,'values') works. And then i fiddle around with setexpression and dummy arrays.
Re: String concatenation and arrays
Posted: 25 Jul 2014 11:29
by oldgearguy
electrofux wrote:If the currentobj is an object referenced by the findobject funtion this indeed doesnt work for me. The code gets red when i put the array brackets behind it.
But i got around it because getexpression(currentobj,'values') works. And then i fiddle around with setexpression and dummy arrays.
That's nice -- I wouldn't have thought to try the on the result of getexpression like that. Good to know it works (well, as of 5.0.3 anyway )
Re: String concatenation and arrays
Posted: 25 Jul 2014 12:57
by electrofux
I would love to use the same for setexpression. There should be a way to set specific array items with just a setexpression.