optional parameter []

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

optional parameter []

Post by enric »

Is there a way to define a FUNCTION with optional parameters?

FUNCTION myFunction (side, [opt1], [opt2]. [etc])
{
//this seems not be accepted by BA
}
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Re: optional parameter []

Post by pipfromslitherine »

No, not for user functions. There are certain callbacks which will happily take functions which need more parameters than they are called with from other parts of the system, but as this varies case by case it's not generally recommended as an approach.

Allowing for default parameters is on my scripting wishlist, but it's a considerable task.

Cheers

Pip
follow me on Twitter here
Post Reply

Return to “Battle Academy : Modders Corner ”