Array inside of an Array
#1

Hello

Well I've been struggling with this for 1~ Hours now, and I can't get it right.
This is an example code of what I'm trying to do.


pawn Код:
enum
    E_ENUM
    {
        Options[4]
    }
pawn Код:
new
      Array[][E_ENUM] =
      {
           {1, 2, 3, 4}
      };
What I want is to insert a integer value into each of the slots of 'Options' array, inside another array.

So for example:

I want 1 to go into 'Options[0]' and 2 to go into 'Options[1]' (Slot is not the same as value due to array slots starting from 0)

Anybody have a idea?

I understand filling the array using a code like:

pawn Код:
Array[0][Options][0] = 1;
But that wouldn't work for what I'm doing.

Just some info:

pawn Код:
:\SA-MPS~1\pawno\script.pwn(45) : warning 227: more initiallers than enum fields
I:\SA-MPS~1\pawno\script.pwn(45) : warning 227: more initiallers than enum fields
Line 43-46:

pawn Код:
new
     Array[][E_ENUM] =
     {
           {1, 2, 3, 4} // 45
     }
Reply
#2

pawn Код:
Array[][E_ENUM] =
     {
           {{1, 2, 3, 4}}
     }
Try this, I think it should work.
The Enum is like another Array, but with only one field for you, so you need the extra brackets.
Reply
#3

I just tested it and it works.

Thankyou, I didn't know you could do that / it worked like that .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)