In your case, it’s as simple as directly creating the script with the cameraEntity like this:
// add the scripts component that will hold the scripts for this entity
cameraEntity.addComponent("script");
// create the script
cameraEntity.script.create('camera', function(context){
// script content here
});
I am however getting this error:
script ‘camera’ is not found, awaiting it to be added to registry
So just going to wait and see if someone knows the right answer.