How do I properly invoke array commands such as append()
on an IntDict[]
array? For example, this is my current sketch testing such a thing:
IntDict[] dictArray;
void setup() {
size(1400, 1000);
/*properly initialized or not?*/
dictArray = new IntDict[2];
append(dictArray, new IntDict());
/*when the compiler stops*/
dictArray[1].set("dictVar", 0);
}
void draw() {
println(dictArray[1].get("dictVar"));
}
The error the console gives me is ‘NullPointerException.’ The sketch window is unresponsive. How do I rewrite the above code?