ZScript named arguments
ZScript supports the ability to add in named arguments. These arguments are useful for leaving other arguments blank in functions.
Note: This feature is for ZScript only. |
In order to use them, several conditions apply.
- Required parameters cannot be skipped and must be filled out. Their names can't be used.
- All parameters must be in the order as defined by the functions.
- The name of the parameter must be used followed immediately with a colon (:)
// Skips xofs, yofs, yvel, and angle parameters. These are also in chronological order. A_SpawnItemEx("Rocket", zofs: 32, xvel: cos(pitch) * 20, zvel: -sin(pitch) * 20, flags: SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_SETTARGET);
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.