Save references in array
Michel L
Posts: 141
I'm writing a spin-object that will work together with a piece of software written in Processing to monitor some values as well as set some variables.
To set variables I would like to save the address of certain variables that can be managed into an array so that the object can change them later.
Something like this:
Main program:
Monitor program:
Any ideas if this is possible and/or could work? Any suggestions for improvements?
To set variables I would like to save the address of certain variables that can be managed into an array so that the object can change them later.
Something like this:
Main program:
var long monitorThis obj monitor : "Monitor" pub start monitor.start monitor.registerVar(0, @monitorThis) ... ' use monitorThis
Monitor program:
var long monitors[10] pub start ... pub registerVar(valIndex, reference) monitors[valIndex] := reference pri setValue(valIndex, value) @monitors[valIndex] := value ...
Any ideas if this is possible and/or could work? Any suggestions for improvements?
Comments
But, yes you can create an array of pointers.
And thanks for the correction. I didn't know I had to use the long[] command for this.
I will make sure to post and share my code/application on the forum and obex. As a thanks for your support. I hope a lot of other people will be able to use my application. It is nowhere as extensive as ViewPort but I hope some monitoring and graphing of variables will be useful.
Michel