restricting object rotation

i have a gun turret on a car that i aim with the mouse i want to be able to restrict the rotation of the turret to the front as if i move the mouse too far it points into the car

this gets the gun to look at the mouse pointer.

var lookTarget : Vector3;

function Update() 
{   
    var ray = Camera.main.ScreenPointToRay (Input.mousePosition);    
    var hit : RaycastHit;    

    if (Physics.Raycast (ray, hit))
    {        
        lookTarget = hit.point;   
    }
    transform.LookAt(lookTarget);
}

how can i set it so it can only pivot in a say 90 degree cone.

Maybe something like:

function Update ()
{
    if (transform.eulerAngles.y >= 90)
        transform.eulerAngles.y = 90;
    if (transform.eulerAngles.y <= -90)
        transform.eulerAngles.y = -90;
}

If the angle is over 90, it will set it to 90, so it won't get past 90, same thing with 90 degrees the other way.

How about this:

var lockPos = 0;

function Update()
{
     transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, lockPos, lockPos);
}