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

New Post: How to pass short int from script to C# methods

$
0
0
Thanks for the response. This is really a awkward limitation. I don't know any language that does not support such
conversion in a standard way. With the suggested work-around, every embedded script engine might have different
way to do conversion (since the name 'host' is implementation dependent.)

Anyway, I found it also strange that ClearScript do support some implicit conversion like the following code works just fine:
    public short MyValue;
    void ClearScriptTest2(object sender, EventArgs e) {
        using (var engine = new V8ScriptEngine()) {
            engine.AddHostObject("Me", this);
            engine.Execute("Me.MyValue = 123;");
            MessageBox.Show(MyValue.ToString());
        }
    }

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images