UTIL VarArgs

From Valve Developer Community
Revision as of 02:14, 12 April 2011 by Mflux (talk | contribs) (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( …')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 );