UTIL VarArgs: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
 (Created page with 'This function will build a C-String similar to printf. It is server-side only!  Example: int iCreepers = 3; char * pFortress = "My Awesome Fort."; char * pOutput = UTIL_VarArgs( …')  | 
				No edit summary  | 
				||
| Line 2: | Line 2: | ||
Example:  | Example:  | ||
<code>  | |||
int iCreepers = 3;  | int iCreepers = 3;  | ||
char * pFortress = "My Awesome Fort.";  | char * pFortress = "My Awesome Fort.";  | ||
| Line 8: | Line 9: | ||
//  prints: There are 3 creepers outside of your My Awesome Fortress.  | //  prints: There are 3 creepers outside of your My Awesome Fortress.  | ||
</code>  | |||
This is useful for quickly building a composite string.  | This is useful for quickly building a composite string.  | ||
<code>  | |||
char * pOutput = UTIL_VarArgs( "X:%f Y:%f Z:%f\n", vec.x, vec.y, vec.z );  | char * pOutput = UTIL_VarArgs( "X:%f Y:%f Z:%f\n", vec.x, vec.y, vec.z );  | ||
</code>  | |||
Revision as of 18:15, 11 April 2011
This function will build a C-String similar to printf. It is server-side only!
Example:
int iCreepers = 3;
char * pFortress = "My Awesome Fort.";
char * pOutput = UTIL_VarArgs( "There are %i creepers outside of your %s.", iCreepers, pFortress );
Msg("%s", output);
//  prints: There are 3 creepers outside of your My Awesome Fortress.
This is useful for quickly building a composite string.
char * pOutput = UTIL_VarArgs( "X:%f Y:%f Z:%f\n", vec.x, vec.y, vec.z );