Added support for calling script functions

This commit is contained in:
2019-06-07 13:52:28 +02:00
parent cd185ed2e5
commit d8bf2c2994
4 changed files with 84 additions and 0 deletions

View File

@@ -93,5 +93,19 @@ namespace PorygonSharpTests
}
}
[Test]
public void Test8()
{
using (var script = new Script("function add(number a, number b) result = a + b end"))
{
script.Evaluate();
script.CallFunction("add", 100, 50);
var variable = script.GetVariable("result");
Assert.AreEqual(TypeClass.Number, variable.GetTypeClass());
var val = variable.EvaluateInteger();
Assert.AreEqual(150, val);
}
}
}
}