Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - MrGreen

#1
Hi!
I cannot access Struct properties via array in AGS 4.0
I only see the length property of the array.

When I try to run it it throws a "Null pointer referenced" error on the first line when I try to access the struct property. (Error line: testStruct_Array[0].int1 = 1;)
However, it works perfectly in 3.6

Any idea what could be the problem?  ???

Header:
Code: ags
managed struct TestStruct {
  int int1;
  int int2;
  int int3;
  bool flag;
};

Script:
Code: ags
TestStruct* testStruct_Array[];

function test_func() {
  testStruct_Array = new TestStruct[10];
  
  testStruct_Array[0].int1 = 1;
  testStruct_Array[0].int2 = 2;
  testStruct_Array[0].int3 = 3;
  testStruct_Array[0].flag = true;
}
SMF spam blocked by CleanTalk