lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


hi people,

i've got a simple and straightforward question regarding the
implementation of file:read(). is it possible to read two numbers, one
following the other, with different ranges? like in c, for example,
assuming a file containing '12345', the code:

        (void)fscanf("%2d", &x);
        (void)fprintf(stdout, "%d!\n", x);
        (void)fscanf("%3d", &x);
        (void)fprintf(stdout, "%d!\n", x);

gets you:

12!
345!

i know the above demonstrated example uses the same backend lua uses to
endorse io operations, so if it's a matter of implementing this feature,
that shouldn't be too difficult...

cheers,
-p.