Custom Variadic Vex Functions

   2206   5   1
User Avatar
Member
22 posts
Joined: Nov. 2016
Offline
I'm looking at a way of creating a custom function in Vex any number of trailing params.

The closest reference I could find is here:

https://www.sidefx.com/docs/hdk/_h_d_k__vex_op.html [www.sidefx.com]

but I don't understand it.

eg.

void myFunc(int arr_i[]; string arr_s; string ...extra_params) {
   s@debug = extra_params[0];
}

here's a go lang example:

Go Variadic [gobyexample.com]

Is this possible? If so can someone give me a simple example?

Thanks in advance!
Edited by traden1976 - Feb. 13, 2020 07:50:59
User Avatar
Member
3 posts
Joined: Feb. 2015
Offline
Hi traden1976!

Could you please elaborate a little bit, what you try to implement?
User Avatar
Member
22 posts
Joined: Nov. 2016
Offline
Hi Ommlet, I want to pass in an arbitrary amount of arrays to be populated. But it's more for the sake of curiosity VS being stuck on a problem.

Just wondering if it's actually possible.

thanks!
User Avatar
Member
897 posts
Joined: July 2018
Offline
This way of declaring functions isn't supported. You should give it a string array instead.
Edited by kahuna031 - Feb. 13, 2020 13:40:22
B.Henriksson, DICE
User Avatar
Member
8035 posts
Joined: Sept. 2011
Offline
You were on the right track, you'll have to compile a custom vex plugin using the HDK.

Edit:
never mind, variadic arguments don't support arrays.

https://www.sidefx.com/docs/hdk/_h_d_k__vex_op.html#HDK_VexOp_Callbacks [www.sidefx.com]
Edited by jsmack - Feb. 13, 2020 14:55:58
User Avatar
Member
22 posts
Joined: Nov. 2016
Offline
Thanks for researching and replying guys! I'll look at different approaches.
  • Quick Links