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

New Post: Cannot set a string as host object?

0
0
Hello!

That's correct; ScriptEngine.AddHostObject() does not work with simple values like strings and numbers.

Instead, you can do any of the following:
engine.Script.test = "hello";
engine.Script["test"] = "hello";
engine.Execute("test = 'hello'");
Cheers!

Viewing all articles
Browse latest Browse all 2297