27.11.2013, 22:23
I was wondering, how to save multi dimensional variables with y_ini via a loop without repeating the same action (or using dini!!!).
So the outcome will be something like:
Unlike the 'lazy' way:
pawn Код:
new Float: gSomeVar[25][3][3];
// ...
new INI:File = INI_Open("nice.ini");
INI_SetTag(File, "Test");
for(new v; v < 25; v++)
{
for(new i; i < 3; i++)
{
INI_WriteFloat(File, "Test", gSomeVar[5][v][i]);
// OR
INI_WriteFloat(File, "Test%d%d", gSomeVar[5][v][i]);
// OR - etc
INI_WriteFloat(File, "Test%d\n", gSomeVar[5][v][i]);
}
}
// ...
pawn Код:
[Test]
Test00 = 99.9
Test01 = 99.9
Test02 = 99.9
Test10 = 99.9
Test11 = 99.9
Test12 = 99.9
Test20 = 99.9
pawn Код:
INI_WriteFloat(File, "Test1", gSomeVar[5][0][0]);
INI_WriteFloat(File, "Test2", gSomeVar[5][0][1]);
INI_WriteFloat(File, "Test3", gSomeVar[5][0][2]);
INI_WriteFloat(File, "Test4", gSomeVar[5][1][0]);
INI_WriteFloat(File, "Test5", gSomeVar[5][1][1]);
INI_WriteFloat(File, "Test6", gSomeVar[5][1][2]);
INI_WriteFloat(File, "Test7", gSomeVar[5][6][0]);
// ... etc