Creating a script instance from an asset

What would be the code to clone a script from the resources folder and put it into a GameObject? I haven’t been able to find anything in the scripting reference about this.

Unity ScriptReference - AddComponent


var nameOfScript : String ; //set name in inspector
function Update(){
      gameObject.AddComponent(nameOfScript) ;

press X, and now you got your script added.