Braodcast message with null parameter

I want to Broadcst a message and the parameter value is sometimes null.

transform.BroadcastMessage("SetTarget",target,SendMessageOptions.DontRequireReceiver)

and sometimes target is null. My SetTarget method can hndle a null case for target but when I try to broadcsst a message where target = null I get
Failed to call function SetTarget of class LightningBolt
Calling function SetTarget with no parameters but the function requires 1.
UnityEngine.Component:BroadcastMessage(String, Object, SendMessageOptions)

Is this there a way around this other than check if target is null and broadcasting a different message for that case?

the recier is a cs file and the sender boo if that matters.

Cheers,
Grant
Turret:Update() (at Assets/Scripts/Turret.boo:32)

(yes I am using a modified version of Jonathan Czeck’s awesome lightningbolt)

I imagine the problem is that if you don’t give the optional parameter, it tries to invoke YourMessage() instead of YourMessage(parameter), and if you haven’t defined the former you’ll get an error.

You can probably work around that by implementing YourMessage() in both ways and having the version without a parameter invoke the version which has one, like this:

function YourMessage()
{
	YourMessage(null);
}

function YourMessage(parameter : Type)
{
	...
}