28.03.2016, 16:18
There is one way to do it.. But it's a bit ugly.
pawn Код:
stock MyFunc(
{Float, _, unused}:var1 = unused:0,
{Float, _, unused}:var2 = unused:0,
{Float, _, unused}:var3 = unused:0,
{Float, _, unused}:var4 = unused:0,
tag1 = tagof(var1),
tag1 = tagof(var2),
tag1 = tagof(var3),
tag1 = tagof(var4)
) {
if (tagof(var1) == tagof(unused:)) {
num_vars = 0;
} else if (tagof(var2) == tagof(unused:)) {
num_vars = 1;
} else if (tagof(var3) == tagof(unused:)) {
num_vars = 2;
} else if (tagof(var4) == tagof(unused:)) {
num_vars = 3;
} else {
num_vars = 4;
}
var values[4], tags[4];
values[0] = _:var1;
values[1] = _:var2;
values[2] = _:var3;
values[3] = _:var4;
tags[0] = tag1;
tags[1] = tag2;
tags[2] = tag3;
tags[3] = tag4;
// you now have values and tags in an array
// if you want to allow many arguments, you must manually add more
}