✅ this error makes no sense

getting a null reference exception here:
static Evaluation eval = new();
static Evaluation eval = new();
and that traces to this:
mgTable[pc][sq] = mgValue[p] + GetMGTable(p)[sq];
mgTable[pc][sq] = mgValue[p] + GetMGTable(p)[sq];
and THAT traces to this:
static int[][] mgTable = new int[12][];
static int[][] mgTable = new int[12][];
am i dumb or is this just not how you construct an array like that?
4 Replies
cap5lut
cap5lut5w ago
u have a jagged array there, so u create an array with 12 elements that can hold int arrays, but u never assign anything to them, so all 12 elements are null:
MODiX
MODiX5w ago
cap5lut
REPL Result: Success
int[][] arr = new int[12][];
arr[0] is null
int[][] arr = new int[12][];
arr[0] is null
Result: bool
True
True
Compile: 296.032ms | Execution: 47.480ms | React with ❌ to remove this embed.
it’s raining outside
ah that makes sense i'll just use a multidimensional one then .close
cap5lut
cap5lut5w ago
glad i could help o7
Want results from more Discord servers?
Add your server