Files
Convention-CSharp/[Test]/Program.cs

39 lines
710 B
C#
Raw Normal View History

using Convention.RScript;
using System;
2025-06-13 10:52:21 +08:00
public class Program
{
2025-10-16 11:29:50 +08:00
static class Test
{
public static object Func(object x)
{
Console.WriteLine(x);
return x;
}
}
2025-06-13 10:52:21 +08:00
static void Main(string[] args)
{
RScriptEngine engine = new();
RScriptImportClass import = new()
{
2025-10-16 10:25:31 +08:00
typeof(Math),
2025-10-16 11:29:50 +08:00
typeof(ExpressionMath),
typeof(Test)
};
var result = engine.Run(@"
2025-10-16 10:25:31 +08:00
int i;
2025-10-16 11:29:50 +08:00
i = 2;
label(test);
2025-10-16 00:39:45 +08:00
goto(true,func1);
goto(100>i,test);
2025-10-10 18:01:38 +08:00
2025-10-16 00:39:45 +08:00
namespace(func1)
2025-10-10 18:01:38 +08:00
{
2025-10-16 11:29:50 +08:00
i = Pow(i,2);
Func(i);
}
", import);
2025-10-16 00:39:45 +08:00
Console.WriteLine($"Script executed successfully. Result: {result["i"].data}");
2025-06-13 10:52:21 +08:00
}
}