NGUI - how do I put a value on a UISlider in Javascript?

I have a variable in javascript, let’s say “health”, that I would like to display it on a slider. How do I do that? I tried every way possible but it just doesn’t work. Also, there’s not any documentation available for javascript, I could only find for C# and I don’t understand it.

I attached this script to my UI Root, but I’m getting error.

var sliderShowHealth : GameObject;
sliderShowHealth = GameObject.Find("healthBar");

function Update () {
sliderShowHealth.GetComponent(UISlider.Value) = //insert health variable here
}

It took me like 4 hours of thrashing to figure this one out, so enjoy:

import UnityEngine.UI;
var sliderShowHealth: UnityEngine.UI.Slider;

function Start () {
     sliderShowHealth = GameObject.Find("healthBar").GetComponent(UnityEngine.UI.Slider);
}

function Update () {
     sliderShowHealth.value = //insert health variable here
}

OMG, that WORKS. You’re welcome.