Many many arguments in function..
#1

Hot to make function like
pawn Код:
SomeFunc(str1[], str2[], ...);
Where "..." there can be, and can be not more function arguments, so I can use
pawn Код:
SomeFunc("Bla", "Bla2", "Bla3", "Bla4");
and so on...

How to make that kind of function ?
Reply
#2

You mean you want to make user defined functions with arguments?

Код:
forward SomeFunction(string1[],string2[]);
public SomeFunction(string1[],string2[])
{
        printf("%s",string1);
        printf("%s",string2);
}
When you call it;
Код:
new stri1[128],stri2[128];
format(stri1,128,"Bla");
format(stri2,128,"Bla2");
SomeFunction(str1,str2);
Reply
#3

Quote:
Originally Posted by DJDhan
Посмотреть сообщение
You mean you want to make user defined functions with arguments?
No, I mean function where i need to use for example first 2 arguments, and then if I want, I can use as many as I need other arguments.
Reply
#4

Код:
SomeFunc(...)
{
	return 1;
}
Then use arg function to get them.
Reply
#5

Oh, (...), in Lua i've use it like this, doesn't knew that in pawn is same
Thanks.
Reply
#6

Look also here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)