Dynamic Array of an Array

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Dynamic Array of an Array

Postby XxMiltenXx » Wed May 16, 2018 3:37 pm

I was trying out to make a dynamic array of an array.
The declration of it works fine, however I ran into a strange issue.

Code: Select allExpand view
version "3.3"

Class MyDoomPlayer : DoomPlayer
{
   Array<double> MyArray[MAXPLAYERS];

   override void Tick()
   {
      int playerNum = PlayerNumber();
      For (int i = 0; i < MyArray.Size(); i++)
      {
         MyArray[playerNum][i] = 2;
      }
      MyArray[playerNum].Push(4);
      Super.Tick();
   }
}


If I try to start the GZDoom with it, I will get the following error message:
Code: Select allExpand view
Script error, "InvalidResizableArray.pk3:zscript.txt" line 12:
Invalid resizable array


Line 12 is this:
Code: Select allExpand view
MyArray[playerNum][i] = 2;


However, if I replace "playerNum" with any number between 0 and 7, it will work fine. I only get the error message when I use the variable instead.
Attachments
InvalidResizableArray.pk3
(317 Bytes) Downloaded 16 times
XxMiltenXx
 
Joined: 08 Jan 2014

Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest