SA-MP Forums Archive
Why can't use . in macro and what means . in PAWN - 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: Why can't use . in macro and what means . in PAWN (/showthread.php?tid=354177)



Why can't use . in macro and what means . in PAWN - Terminator3 - 25.06.2012

As in title
pawn Код:
#define X:%0.%1(%2) something
why it gives an error that it found . (dot) ?

And . (dot) in PAWN means only float value or something else?


Re: Why can't use . in macro and what means . in PAWN - iggy1 - 25.06.2012

Here's an example of another use for dot. You can use it in functions to specify a parameter in a function call.

pawn Код:
public OnFilterScriptExit()
{
    foo( .arg3 = 1, .arg2 = 2, .arg1 = 3, .arg0 = 4 );//not called in order of function definition
    return 1;
}

foo(arg0=0, arg1=0, arg2=0, arg3=0)
{
    printf( "%d %d %d %d", arg0, arg1, arg2, arg3);//should print 4 3 2 1
}
Though i don't know if that's your problem, because i don't know what your trying to do with the code you posted.

EDIT: It looks like a strange macro (syntax at least) this would work with it now. (no errors i mean)

pawn Код:
#define X:%0.%1(%2) 1

new i = X:a.a(5);
//or even
new i = X:^.^(666);
The problem is probably in the code that follows the macro header.


Re: Why can't use . in macro and what means . in PAWN - Terminator3 - 25.06.2012

Lol, i try it again and works, don't know why the last time they give me strange error :P

thanks anyway

But new question

pawn Код:
#define X:%0.%1(%2) %1(%0,%2)
#define X:%0.some() somethingelse(%0)
and this gives me error
Quote:

: warning 201: redefinition of constant/macro (symbol "X:%0.some()")

some clever ideas on how to do it?