Pass a function(float) as variable

So I have this simple function:

function FadeIn(speed : float){
	fadeSpeed = speed;
	fadeDir = -1;
}

and I want to add it to a class by doing something like this:

//The class type
class ScriptStep {
	var subScript : List.<ScriptStep>;
	var stepHoldLength : float;
	var stepTransform : Transform;
	var audioClip : AudioClip;
	var textLine : String;
	var stepFade : function(float);

//And the function
function AddStep (currentScript : List.<ScriptStep>, stepFade : function(float)){
	var step = new ScriptStep ();
		step.stepFade = stepFade;
	currentScript.Add(step);
}

But whenever I try to actually run it:

AddStep (gameIntro, dialogInteractions.FadeIn(0));

I keep getting the error:

No appropriate version of 'Dialog_Manager.AddStep' for the argument list '(System.Collections.Generic.List., void)' was found.

What am I doing wrong exactly? A bit new to javascript and just started to learn how to declare variables of the type function…

Any help very appreciated!

Your code should be:

AddStep (gameIntro, dialogInteractions.FadeIn);

You can’t pass in an argument when you’re adding a function as a variable. You can only use an argument when you actually call the function, such as

step.stepFade(0);

Use of file in top of the script.

using System.Collection.Generic;

this is use for the List which is used by you in your script.

List can not add any type of whole function but it can add the value of function.
So, make your function with its return type.