05-09-2023, 02:29 PM
You can do this much simpler.
Member function str.CallCS
Function test
Member function str.CallCS
function~ str'_Fun [ARRAY(str)&as]
CsScript x.AddCode(this)
if(as.len)
,ret x.Call(_Fun as)
else
,out "Error!! No arguments were passed"
Function test
_s=
;using System;
;
;public class cla
;{
;,public static string Fun1(string[] args)
;,{
;;;;;;;;//use if space is added at end of each line in multiline args str below
;,,//string result = string.Concat(args);
;;;;;;;// use if no space is added at end of each line in multiline args str below
;;;;;;;;string result = string.Join(" ", args);
;,,Console.WriteLine(result);
;,,return result;
;,}
;}
ARRAY(str) a
;1 arg
str args=
;First parameter
a=args
_s.CallCS("Fun1" a)
;2 args
args=
;First parameter
;Second parameter
a=args
_s.CallCS("Fun1" a)
;3 args
args=
;First parameter
;Second parameter
;Third parameter
a=args
_s.CallCS("Fun1" a)
;4 args
args=
;First parameter
;Second parameter
;Third parameter
;Forth parameter
a=args
_s.CallCS("Fun1" a)
;no args error handling
args=""
a=args
_s.CallCS("Fun1" a)