Apologies if this has been answered before. Is it possible to declare a new variable using a string for the name?
For example: something along these lines (doesnt' work of course, but you see the intent):
ArrayList <String> variableNames = new ArrayList <String> ();
void setup(){
variableNames.add("name1");
variableNames.add("name2");
variableNames.add("name3");
for (int i = 0; i < variableNames.size(); i = i+1) {
//extract string form arraylist to name the new float
public float (String)variableNames.get(i) = 100;
}
void draw(){
//now access the variable using the same string to modify it
(String)variableNames.get(0) = 500;
}
this is primarily for the purposes of creating new objects from a list of names extracted from an xml file. these objects need to be acted upon later in the sketch using ControlP5 sliders.
Thanks for your help!
1