SA-MP Forums Archive
How to ignore an argument? - 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 ignore an argument? (/showthread.php?tid=325689)



How to ignore an argument? - T0pAz - 14.03.2012

How to ignore an argument which has no predefined value?


Re: How to ignore an argument? - Stylock - 14.03.2012

Do you mean this:
pawn Код:
#pragma unused argument
(?)


Respuesta: Re: How to ignore an argument? - kirk - 14.03.2012

Quote:
Originally Posted by YJIET
Посмотреть сообщение
Do you mean this:
pawn Код:
#pragma unused argument
(?)
That wouldnt work as it would ignore a variable named "argument"


Re: Respuesta: Re: How to ignore an argument? - Stylock - 14.03.2012

Quote:
Originally Posted by kirk
Посмотреть сообщение
That wouldnt work as it would ignore a variable named "argument"
Uhm.. you can also ignore arguments:
pawn Код:
Function(arg)
{
    #pragma unused arg
    return 1;
}



Re: Respuesta: Re: How to ignore an argument? - T0pAz - 15.03.2012

Quote:
Originally Posted by YJIET
Посмотреть сообщение
Uhm.. you can also ignore arguments:
pawn Код:
Function(arg)
{
    #pragma unused arg
    return 1;
}
Not that.


Re: How to ignore an argument? - SimonItaly - 15.03.2012

I don't understand why ignore an argument if it doesn't have a predefined value.
Couldn't you have "stock Function(arg = 0)"?


Re: How to ignore an argument? - T0pAz - 15.03.2012

Quote:
Originally Posted by DarkSlyder
Посмотреть сообщение
I don't understand why ignore an argument if it doesn't have a predefined value.
Couldn't you have "stock Function(arg = 0)"?
No, I want to achieve something else.


Re: How to ignore an argument? - iPLEOMAX - 15.03.2012

You want to solve "function argument may not have a default value (variable X)"

Yes?

If that, just create a stock,
pawn Код:
stock ABC( somevar = 5 ) {...}
then
pawn Код:
public ABC_pub( somevar ) {...}



Re: How to ignore an argument? - T0pAz - 15.03.2012

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
You want to solve "function argument may not have a default value (variable X)"

Yes?

If that, just create a stock,
pawn Код:
stock ABC( somevar = 5 ) {...}
then
pawn Код:
public ABC_pub( somevar ) {...}
But reference cannot have a predefined value. I am really puzzled.