Y_ini loop saving question
#1

I was wondering, how to save multi dimensional variables with y_ini via a loop without repeating the same action (or using dini!!!).

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]);
    }
}
// ...
So the outcome will be something like:
pawn Код:
[Test]
Test00 = 99.9
Test01 = 99.9
Test02 = 99.9
Test10 = 99.9
Test11 = 99.9
Test12 = 99.9
Test20 = 99.9
Unlike the 'lazy' way:
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
Reply


Messages In This Thread
Y_ini loop saving question - by Loot - 27.11.2013, 22:23
Re: Y_ini loop saving question - by erminpr0 - 27.11.2013, 22:32
Re: Y_ini loop saving question - by Jefff - 27.11.2013, 22:57
Re: Y_ini loop saving question - by Loot - 27.11.2013, 23:19

Forum Jump:


Users browsing this thread: 2 Guest(s)