Posts: 156
Threads: 12
Joined: Jan 2016
Hi im interested to know how i can create custom specifier in pawn i read panw implementers guide but i cant find anything valuable about it.And yeah also there is anything like typedef thing as in c++ in pawn to define new tags (i know pawn is typless but we can create new tags huh).Or we can just define it like this:
PHP Code:
new sometag:var;
and will be a new tag?that part is also not understood from implementor's guide thats why im asking this.Thanks in advance.
Posts: 1,092
Threads: 4
Joined: Jun 2012
Reputation:
0
You can do that...but WHY?
This just gives you a huge of troubles...and it optimize nothing...
Posts: 156
Threads: 12
Joined: Jan 2016
I would appreciate if you share your knowledge. Im willing to take any trouble. But dont ask me why im doing this. I use pawn not just for samp but also for something else which i cant tell here. And i can also make use of it here too.
Posts: 156
Threads: 12
Joined: Jan 2016
Thanks but i already read it what im asking is can i create new tags and specifiers?
Creating tag can be just be done like this
or is there any other function like typedef?
Posts: 156
Threads: 12
Joined: Jan 2016
Quote:
Originally Posted by Kaliber
No, there is no function (btw typedef is an operator).
So you have to do sth like this:
PHP Code:
new test:a;
//for functions where u allow only a specific tag:
func(test:x) //If you give here a variable with another tag... = warning
{
}
//You can also do
func(x)
{
new tmp = tagof (x);
if(tmp == tagof (test:))
{
//x is from type test
}
else
{
//Here its not
}
}
|
Thanks my doubt about tag cleared and yeah typedef is an operator my mistake.
Ok now about specifiers?
Posts: 156
Threads: 12
Joined: Jan 2016
Quote:
Originally Posted by Kaliber
What you wanna know about that?
Dont know what you mean exactly by this...
|
for eg in samp when SQLite introduced after some while a new specifier %q was introduced for db escape.that means a new specifier was added or created for samp. Another eg is specifier u for playerid and name in sscanf .Like that how can i create new one?