View Single Post
Old 06/02/2018, 07:49 PM   #746
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 575
Reputation: 73
Default Re: Today I learned - Share your newly found knowledge!

Quote:
Originally Posted by Freaksken View Post
TIL you can ignore parameters passed by reference (out parameters) by using a default value, just like you can with parameters passed by value (in parameters):

Code:
stock Float:DoSomething(playerid, &Float:a = 4.0) {
	a = 5.0;
	return 9.0;
}
The default value can be anything, since it will be ignored anyway.

Use:
Code:
DoSomething(0); //Returns 9.0

new Float:a;
DoSomething(0, a); //Returns 9.0 and variable 'a' contains 5.0
Great find!

Would expect a tag mismatch with this, but this is great.
ISmokezU is offline   Reply With Quote