AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   return and return value. (https://forums.alliedmods.net/showthread.php?t=48147)

NewUser 12-05-2006 22:41

return and return value.
 
Does
Code:
return;
do the same thing as:
Code:
return PLUGIN_HANDLED;

If they don't, please elaborate why.

jim_yang 12-05-2006 22:53

Re: return and return value.
 
#define PLUGIN_CONTINUE 0 /* Results returned by public functions */
#define PLUGIN_HANDLED 1 /* stop other plugins */
#define PLUGIN_HANDLED_MAIN 2 /* to use in client_command(), continue all plugins but stop the command */

XxAvalanchexX 12-05-2006 23:38

Re: return and return value.
 
Calling return without specifying a value uses a value of 0. So, based on jim_yang's post, they would not function the same, as the first would return PLUGIN_CONTINUE.

Also note that a function can't return a value (ie: "return 1") and return nothing (ie: "return"). But, if you use the latter, then the compiler won't yell at you if you don't end your function with a return value.


All times are GMT -4. The time now is 06:52.

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