static void Main(string[] args) { SPIDER.Function notifier = new SPIDER.Function("test"); notifier.Args() .Arg <int>("argument1") .Arg <int>("argument2") .Returns() .Ret <int>("returnValue") .Complete(); while (true) { try { int argument1 = 11; int argument2 = 11; int returnValue = 0; notifier.Args() .Push <int>("argument1", argument1) .Push <int>("argument2", argument2); notifier.Call(); notifier.Returns() .Get <int>("returnValue", out returnValue); } catch (Exception e) { System.Console.WriteLine(e.Message); } } }
static void Main(string[] args) { SPIDER.Function function = new SPIDER.Function("test", (function) => { try { int argument1 = 0; int argument2 = 0; function.Args() .Get <int>("argument1", out argument1) .Get <int>("argument2", out argument2); int result = argument1 + argument2; function.Returns() .Push <int>("returnValue", result); } catch (Exception e) { System.Console.WriteLine(e.Message); } }); function.Args() .Arg <int>("argument1") .Arg <int>("argument2") .Returns() .Ret <int>("returnValue") .Complete(); while (true) { System.Threading.Thread.Sleep(100); } }