lua-users home
lua-l archive

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

Hey guys, maybe this is stupid question which is why no-one responded
to it. Or maybe it just does not matter. You can tell me if it is either
of the above.

Currently select(n, field) returns only paramters after the nth parameter.

If we were to change the code to below and allow negative numbers for
"n" we good also say:
return the last n parameters (which can be handy)..

    int i = luaL_checkint(L, 1);
    if (i < 0) i = n+i;
    else if (i == 0) i = 1;
    else if (i >= n) i = n;
    return n - i;