Scripting Melee weapons?

First off, I am a complete noob when it comes to javascript, which is what I want to be scripting in. I am learning C++ in school, though.

Now, to the question: how would I script a melee weapon? I’m basically asking for someone to either post a script and explain every part of it to me or tell me the aplicable words in javascript and how to use them. Sorry if that sounds arrogant.

Add a box collider to your [sword], set its Is Trigger property.

// Damage dealt on hit
var damage : int;
// Who's holding me?
var holder : Actor;
// Where am I being held / what hand is holding me?
var handHolding : Transform;

// Run on object load
function Start() {
 // Ignore collisions with my holder
 Physics.IgnoreCollision( collider, holder.collider );
 // Snap me to the hand that's holding me
 transform.parent = handHolding;
 transform.position = handHolding.position;
 transform.rotation = handHolding.rotation;
}

// Run whenever something enters my collider
OnTriggerEnter( other : Collider ) {
 // Get the Actor component of the thing that I hit
 var thing : Actor = other.GetComponent(Actor);
 // If that exists (i.e., I hit an Actor)
 if ( thing ) {
  // Knock its health down.
  thing.health -= damage;
 }
}

Obviously you’d need to change out Actor for whatever you use to control your alive entities.