AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   #define s_is_number(%1) isdigit(%1) (https://forums.alliedmods.net/showthread.php?t=201117)

.Dare Devil. 11-17-2012 10:30

#define s_is_number(%1) isdigit(%1)
 
Hello.

I want to change all amxmodx natives names, so it will be easy to me to remember those.
Each language use same function but different name it just confuses...

My question is how does computer see that
PHP Code:

#define s_is_number(%1) isdigit(%1) 

?

Is my way slower or are same like calling isdigit(ch)?
Thanks!

Neeeeeeeeeel.- 11-17-2012 10:36

Re: #define s_is_number(%1) isdigit(%1)
 
The compiler just replace every s_is_number with isdigit.

Arkshine 11-17-2012 10:36

Re: #define s_is_number(%1) isdigit(%1)
 
What you do is a macro. If you write s_is_number, when you will compile the plugin, any occurrence of this name will be replaced by isdigit.

.Dare Devil. 11-17-2012 12:20

Re: #define s_is_number(%1) isdigit(%1)
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 1839350)
The compiler just replace every s_is_number with isdigit.

Quote:

Originally Posted by Arkshine (Post 1839351)
What you do is a macro. If you write s_is_number, when you will compile the plugin, any occurrence of this name will be replaced by isdigit.

Thanks!

One question more
if num_to_str( number, string[], ilen)
how #define s_number_to_string(?)
I cant remember how it goes ...

YamiKaitou 11-17-2012 12:21

Re: #define s_is_number(%1) isdigit(%1)
 
PHP Code:

#define s_number_to_string(%1,%2,%3) num_to_str(%1,%2,%3) 


.Dare Devil. 11-17-2012 12:22

Re: #define s_is_number(%1) isdigit(%1)
 
Quote:

Originally Posted by YamiKaitou (Post 1839401)
PHP Code:

#define s_number_to_string(%1,%2,%3) num_to_str(%1,%2,%3) 


are your sure?
%2 is string[] ? :)

YamiKaitou 11-17-2012 12:23

Re: #define s_is_number(%1) isdigit(%1)
 
Have you tried it?

ConnorMcLeod 11-17-2012 12:55

Re: #define s_is_number(%1) isdigit(%1)
 
formatex is faster :)

PHP Code:

#define s_number_to_string(%0,%1,%2)     formatex(%1,%2,"%d",%0) 


fysiks 11-17-2012 14:07

Re: #define s_is_number(%1) isdigit(%1)
 
Please don't ever release plugins if you are going to do this. Don't ask for help with the code for that matter, you ruin readability for the community. It's better if you just learn something.

micapat 11-17-2012 14:09

Re: #define s_is_number(%1) isdigit(%1)
 
Zombie plague style. You CANT understand.


All times are GMT -4. The time now is 20:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.