Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
An array of variant types
#3
Used in scenarios like the one below

Function arrVar
Code:
Copy      Help
function` [`_A1] [`_A2] [`_A3] [`_A4] [`_A5] [`_A6]

CsScript x.AddCode("" 0x10000)

ARRAY(VARIANT) args.create
sel getopt(nargs)
,case 1 args[]=_A1
,case 2 args[]=_A1; args[]=_A2
,case 3 args[]=_A1; args[]=_A2; args[]=_A3
,case 4 args[]=_A1; args[]=_A2; args[]=_A3; args[]=_A4
,case 5 args[]=_A1; args[]=_A2; args[]=_A3; args[]=_A4; args[]=_A5
,case 6 args[]=_A1; args[]=_A2; args[]=_A3; args[]=_A4; args[]=_A5; args[]=_A6

str command=
;cd
ret x.Call("test.Call2" command args)

#ret

public class test
{
,public static string Call2(string command, params object[] args)
,{
,,Console.WriteLine(command);
,,//
,}
}

Quote:SAFEARRAY like in CsFunc

I tried, but had no luck.

Quote: VARIANT* (then it's &_A1)

That should be the idea, but I don't know how to modify the code.

The following code throws an "invalid type cast" error at runtime.
Code:
Copy      Help
VARIANT* args=&_A1


Messages In This Thread
An array of variant types - by Davider - 06-06-2025, 11:11 AM
RE: An array of variant types - by Gintaras - 06-06-2025, 11:41 AM
RE: An array of variant types - by Davider - 06-06-2025, 12:24 PM
RE: An array of variant types - by Gintaras - 06-06-2025, 01:23 PM
RE: An array of variant types - by Davider - 06-06-2025, 01:47 PM
RE: An array of variant types - by Gintaras - 06-06-2025, 02:05 PM
RE: An array of variant types - by Davider - 06-06-2025, 02:13 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)