Dynamic Array of an Array

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Dynamic Array of an Array

Dynamic Array of an Array

by XxMiltenXx » Wed May 16, 2018 2: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 all

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 all

Script error, "InvalidResizableArray.pk3:zscript.txt" line 12:
Invalid resizable array
Line 12 is this:

Code: Select all

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 48 times

Top