05-09-2023, 11:46 AM
The following methods are tested to be effective, Is there a better way?
Macro Test
Member function str.CallCS
Macro Test
_s=
;using System;
;
;public class cla
;{
;,public static string Fun1(string str1)
;,{
;,,string result = str1;
;,,Console.WriteLine(result);
;,,return result;
;,}
;
;,public static string Fun2(string str1, string str2)
;,{
;,,string result = str1 + str2;
;,,Console.WriteLine(result);
;,,return result;
;,}
;
;,public static string Fun3(string str1, string str2, string str3)
;,{
;,,string result = str1 + str2 + str3;
;,,Console.WriteLine(result);
;,,return result;
;,}
;}
str arg1=
;first parameter
_s.CallCS("Fun1" arg1)
str arg2=
;second parameter
_s.CallCS("Fun2" arg1 arg2)
str arg3=
;Third parameter
_s.CallCS("Fun3" arg1 arg2 arg3)
Member function str.CallCS
function~ str'_Fun [str'_Arg1] [str'_Arg2] [str'_Arg3] [str'_Arg4]
CsScript x.AddCode(this)
sel getopt(nargs)
,case 1 ret x.Call(_Fun)
,case 2 ret x.Call(_Fun _Arg1)
,case 3 ret x.Call(_Fun _Arg1 _Arg2)
,case 4 ret x.Call(_Fun _Arg1 _Arg2 _Arg3)
,case 5 ret x.Call(_Fun _Arg1 _Arg2 _Arg3 _Arg4)