Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Unassigned: Calling a function with a parameter in JScriptEngine [56]

0
0
I initialize my engine with the following lines:

```
Dim engine As JScriptEngine
engine = New JScriptEngine(WindowsScriptEngineFlags.EnableDebugging)
engine.AddHostType("Console", GetType(Console))

```

I add the following script to the engine:

```
function Test(param) {
Console.WriteLine("Called Test with param: " + param);
}
```

When I call

```
engine.Script.Test(20)
```

It prints: "Called Test with param: undefined"

Does JScriptEngine not support calling internal functions with parameters?
Comments: Hello! ClearScript 5.4 fixed several issues related to dynamic script item invocation for non-C# hosts. Please make sure you're using ClearScript 5.4.0 or later. Thanks!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images