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

New Post: Byte converted to Int

0
0
Hi ravetam,

There are a couple of ways to do it. First, you can use HostFunctions.toByte():
engine.AddHostObject("host", new HostFunctions());
engine.Execute(@"
    var b = host.toByte(162);
");
Another way is to use a host variable:
engine.AddHostType("Byte", typeof(Byte));
engine.Execute(@"
    var b = host.newVar(Byte);
    b.value = 162;
");
Cheers!

Viewing all articles
Browse latest Browse all 2297