This commit is contained in:
2025-10-16 11:29:50 +08:00
parent a91c9741e4
commit 8d6f96b99a
2 changed files with 15 additions and 5 deletions

View File

@@ -3,25 +3,35 @@ using System;
public class Program
{
static class Test
{
public static object Func(object x)
{
Console.WriteLine(x);
return x;
}
}
static void Main(string[] args)
{
RScriptEngine engine = new();
RScriptImportClass import = new()
{
typeof(Math),
typeof(ExpressionMath),
typeof(Test)
};
import.Add(typeof(ExpressionMath));
var result = engine.Run(@"
int i;
i = 2.2;
i = 2;
label(test);
goto(true,func1);
goto(100>i,test);
namespace(func1)
{
i = Pow(i,2.0);
i = Pow(i,2);
Func(i);
}
", import);
Console.WriteLine($"Script executed successfully. Result: {result["i"].data}");