04.06.2017, 10:47
Hello,
Maybe someone will know better way of doing this:
There is one big downside - I have to write new line for every possible argument count. I can't use #define in this place.
Maybe someone will know better way of doing this:
Код:
m_query(const query[], const callback[] = "", const format[] = "", {Float, _}:...) { new args = numargs(); if(args > 3) { switch(args) { case 4: mysql_tquery(gSQL, query, callback, format, getarg(3)); case 5: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4)); case 6: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4), getarg(5)); case 7: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4), getarg(5), getarg(6)); case 8: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4), getarg(5), getarg(6), getarg(7)); case 9: mysql_tquery(gSQL, query, callback, format, getarg(3), getarg(4), getarg(5), getarg(6), getarg(7), getarg(8)); } } else { mysql_tquery(gSQL, query); } }