How to get the number of arguments passed to a function? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to get the number of arguments passed to a function? (
/showthread.php?tid=364935)
How to get the number of arguments passed to a function? -
[MM]RoXoR[FS] - 01.08.2012
I am trying to make a function .
In C++, we do like
Suppose
pawn Код:
float avg( int Count, ... )
{
va_list Numbers;
va_start(Numbers, Count);
int Sum = 0;
for(int i = 0; i < Count; ++i )
Sum += va_arg(Numbers, int);
va_end(Numbers);
return (Sum/Count);
}
What I want is to remove int Count argument. I dont want user to calculate and tell code about the number of arguments.
Any way of doing it?
Also, How do I do it for PAWN.
Re: How to get the number of arguments passed to a function? -
iggy1 - 01.08.2012
https://sampforum.blast.hk/showthread.php?tid=77000