multidimensional array: alternative?
#1

I'm making an include for something, and I need to address a multidimensional array within an enum. The following example will not work:

pawn Code:
// This, ofcourse, will not give any errors
#define ARRAY_SIZE 10
#define ENUM_SIZE 10

enum edata {
    E_DATA[ARRAY_SIZE]
}
new Enum[ENUM_SIZE][edata];

// This will not work, assuming "idx" is a valid index (Line 45)

Enum[idx][E_DATA[idx]] = someValue;

// This also gives some errors
Enum[idx][E_DATA][idx] = someValue;
Are there any alternatives for this? i'd like to keep the enum as this simplifies my problem. The errors are as followed:

Code:
C:~PATH~\~INCLUDE~.inc(45) : error 028: invalid subscript (not an array or too many subscripts): "E_DATA"
C:~PATH~\~INCLUDE~.inc(45) : warning 215: expression has no effect
C:~PATH~\~INCLUDE~.inc(45) : error 001: expected token: ";", but found "]"
C:~PATH~\~INCLUDE~.inc(45) : error 029: invalid expression, assumed zero
C:~PATH~\~INCLUDE~.inc(45) : fatal error 107: too many error messages on one line
Reply
#2

I think it's:
pawn Code:
Enum[idx][E_DATA][idx] = someValue;
Otherwise make a normal three dimensional array.
Reply
#3

Quote:
Originally Posted by Vince
View Post
I think it's:
pawn Code:
Enum[idx][E_DATA][idx] = someValue;
Otherwise make a normal three dimensional array.
My bad I didn't put it in the post. The errors for that case are as followed:

Code:
C:~PATH~/~INCLUDE~.inc(45) : warning 213: tag mismatch
C:~PATH~/~INCLUDE~.inc(45) : error 032: array index out of bounds (variable "Enum")
C:~PATH~/~INCLUDE~.inc(52) : error 008: must be a constant expression; assumed zero
C:~PATH~/~INCLUDE~.inc(52) : error 009: invalid array size (negative, zero or out of bounds)
C:~PATH~/~INCLUDE~.inc(52) : error 036: empty statement
C:~PATH~/~INCLUDE~.inc(52) : fatal error 107: too many error messages on one line
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)