Enumeration Issue - Multidimensional Arrays
#1

Good Morning All!

I'm playing around with making a file system to optimize my server a little more. It was originally using dini as I started the project as a private server for me and a few friends, now it's expanding and file handling is draining my dedicated server of resources.

Just to point out; I probably won't be releasing it - as I know there's already loads of INI systems and the majority of the SAMP community is moving to MySQL.

I have the following enumeration line:
pawn Код:
enum INI_Cache_ENUM {ini_FILENAME[64], ini_KEY[50][64], ini_DATA[50][128]}
(I also have an array for it, but that isn't the issue/concern).

The line I posted above, when compiling, gives the following error:
Код:
error 001: expected token: "}", but found "["
I don't understand why I'm getting that error. What I'm attempting to do, I have actually done before now!

I can guarantee that someone out there will go, THERE IT IS! - That's why I'm posting here!

Thanks,
Ash
Reply
#2

I don't think you can have four dimensional arrays in sa-mp, thus you're getting that error. Somebody correct me if I'm wrong!

EDIT: Of course I meant FOUR dimensional arrays.
Reply
#3

you can't do
pawn Код:
enum INI_Cache_ENUM {ini_FILENAME[64], ini_KEY[50][64], ini_DATA[50][128]}
only
pawn Код:
enum INI_Cache_ENUM {ini_FILENAME[64], ini_KEY[50], ini_DATA[50]}
i think
Reply
#4

Quote:
Originally Posted by playbox12
Посмотреть сообщение
I don't think you can have four dimensional arrays in sa-mp, thus you're getting that error. Somebody correct me if I'm wrong!

EDIT: Of course I meant FOUR dimensional arrays.
Quote:
Originally Posted by [ISS]jumbo
Посмотреть сообщение
you can't do
pawn Код:
enum INI_Cache_ENUM {ini_FILENAME[64], ini_KEY[50][64], ini_DATA[50][128]}
only
pawn Код:
enum INI_Cache_ENUM {ini_FILENAME[64], ini_KEY[50], ini_DATA[50]}
i think
Actually, you could be right as strings are arrays themselves so an array on top of an array on top of an array on top of an array might not work (That's confusing).

I'll move it to separate variables, link them via name rather than array.

Edit: Saying that, that doesn't explain why it's worked before...

Thanks!
Ash
Reply
#5

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Actually, you could be right as strings are arrays themselves so an array on top of an array on top of an array on top of an array might not work (That's confusing).

I'll move it to separate variables, link them via name rather than array.

Edit: Saying that, that doesn't explain why it's worked before...

Thanks!
Ash
I just tried creating a four dimensional array and got an error;

pawn Код:
new test[10][10][10][10];
//error 053: exceeding maximum number of dimensions

I think the enum confuses the compiler thus it throws out that error.
Reply
#6

Quote:
Originally Posted by playbox12
Посмотреть сообщение
I just tried creating a four dimensional array and got an error;

pawn Код:
new test[10][10][10][10];
//error 053: exceeding maximum number of dimensions

I think the enum confuses the compiler thus it throws out that error.
Right, I'm going on a script hunt - I've done it exactly how I posted originally! I know that way won't work, however the PAWN Language guide says you're limited to 2-dimensional arrays, yet we CAN have strings in enumeration, making the array 3-dimensional. There is a way, I'm sure of it!

(There probably isn't, I probably fail)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)