Just curious, Just started using V8ScriptEngine, I have this code fragment
private void button1_Click(object sender, EventArgs e)
{
string f = "function myFunc(x) {if(x >= 3500.00) return '001'; else return '002'; }";
string r = "";
using (var eng = new V8ScriptEngine()) {
eng.Evaluate(f);
r = (string)eng.Script.myFunc(3500.0000001);
}
Console.WriteLine("r={0}", r);
}
and that works fine..
How does Script engine infer that the scripting language is Javascript ?, I would imagine that it has to evaluate entire script-block to assert if it is java or vb or any other supported language, wouldn't it be an expensive task ?, or is it possible to tell the Scriptengine that the language target is of a specific flavour ?