GUI.ModalWindow not working and is perfectly fine constructed

Hi guys, this is UnityScript, I’m heading to insanity, tell me, what’s wrong with this line:

// inside OnGUI()
GUI.ModalWindow(0, (Rect(0, 0, 200, 100)), DoMyWindow(), “title”);

DoMyWindow() do just the same as this example => Unity - Scripting API: GUI.Window , it’s perfectly copied:

function DoMyWindow(windowID : int) {
if (GUI.Button(Rect(10, 20, 100, 20), “Hello World”)) {
print (“Got a click”);
}
}

and the complier is throwing me this:

Error BCE0017: The best overload for the method ‘GUIQuestion.DoMyWindow(int)’ is not compatible with the argument list ‘()’. (BCE0017) (Assembly-UnityScript)

I’ve tried putting 0 as the first argument of DoMyWindow(), and not throwing me the error anymore, BUT the example(look at the link above) doesn’t show that must be passed, strange stuff.
Anyway the second error which is throwing me is:

Error BCE0023: No appropriate version of ‘UnityEngine.GUI.ModalWindow’ for the argument list ‘(int, UnityEngine.Rect, void, String)’ was found. (BCE0023) (Assembly-UnityScript)

This is driving me to madness because there is a version like that, in fact is the main way, look at the API => Unity - Scripting API: GUI.ModalWindow , so what is happening? This doesn’t compile. I’m on Windows 7 x64. I’ll appreciate your help.

You wrote “DoMyWindow()” rather than “DoMyWindow”. You only use parameters when you’re calling the function, not specifying it as a delegate, when you simply use the name. e.g.,

function Start () {
    var someDelegate = MyFunction;
    someDelegate();
}

function MyFunction () {
    Debug.Log ("Like, whoa");
}

–Eric

Oh dude, I have to be very patience with UnityScript. Thank you so much, it works.