ZScript named arguments
Jump to navigation Jump to search
|Note: This feature is for ZScript only.|
ZScript supports the ability to add in named arguments. These arguments are useful for leaving other arguments blank in functions.
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);