String Array
#1

Hi there!
i'm trying to embed this 2 arrays
Код:
new array1[][][] = 
{
	{"text array 1", "text array 1.5"},
	{"text array 1 - 2", "text array 1.5 - 2"}
};
new array2[][][] = 
{
	{"text array 2", "text array 2.5"}
};
into only one, but with 2 index
something like:

Код:
array[0][][] = 
{
	{"text array 1", "text array 1.5"},
	{"text array 1 - 2", "text array 1.5 - 2"}
}
array[1][][] =
{
	{"text array 2", "text array 2.5"}
};
but i have no idea how to declare it, can someone help me?
Reply
#2

You would need a 4. dimension which isn't supported by the native compiler
Even if you put them together the compiler would complain that the arrays have different sizes

But you can do a little trick and remove 1 dimension
PHP код:
new _array[][][] = 
{
    {
        
"text array 1""text array 1.5",
        
"text array 1 - 2""text array 1.5 - 2"
    
},
    {
        
"text array 2""text array 2.5"
    
}
};
#define array[%0][%1][%2] _array[%0][(2 * (%1)) + (%2)] 
You could use a macro to simulate the additional dimension or add the calculation each time
Reply
#3

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
You would need a 4. dimension which isn't supported by the native compiler
Even if you put them together the compiler would complain that the arrays have different sizes

But you can do a little trick and remove 1 dimension
PHP код:
new _array[][][] = 
{
    {
        
"text array 1""text array 1.5",
        
"text array 1 - 2""text array 1.5 - 2"
    
},
    {
        
"text array 2""text array 2.5"
    
}
};
#define array[%0][%1][%2] _array[%0][(2 * (%1)) + (%2)] 
You could use a macro to simulate the additional dimension or add the calculation each time
Thanks! It works perfectly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)