29.05.2013, 23:07
Hello there, I was trying to do some trick with #define but failed. I wanted to make this code
work as same as this
So I went for #define and wrote my code:
But, unfortunately it gave these errors/warnings:
I'll be graceful, if you help me fix this code or tell if this can be done in another way (maybe with some text editor?).
P.S. What I'm doing may sound pointless to some people, however this is so useful for me as I'm converting some script of mine from C++ to PAWN.
pawn Code:
tData[0].a = 0;
pawn Code:
tData[0][a] = 0;
pawn Code:
#include <a_samp>
#define tData[%0].%1 \
tData[%0][%1]
enum data {
a,
b
}
new tData[50][data];
public OnFilterScriptInit()
{
tData[0].a = 0; // line 15
return 1;
}
Code:
(15) : warning 236: unknown parameter in substitution (incorrect #define pattern) (15) : error 029: invalid expression, assumed zero (15) : warning 215: expression has no effect (15) : error 001: expected token: ";", but found "]" (15) : error 029: invalid expression, assumed zero (15) : fatal error 107: too many error messages on one line
P.S. What I'm doing may sound pointless to some people, however this is so useful for me as I'm converting some script of mine from C++ to PAWN.